diff --git a/Testing.md b/Testing.md new file mode 100644 index 00000000000..c17f481ce0e --- /dev/null +++ b/Testing.md @@ -0,0 +1,91 @@ +# Testing _fastlane_ + +## Testing your local changes + +### Checking it all + +The `Fastfile` included at the top of the fastlane project allows you to run several validation steps, such as automated tests, code style and more. + +``` +bundle exec fastlane test +``` + +You can also run those steps independently or on a more fine grained way. + +### Automated tests + +Make sure to run the automated tests using `bundle exec` to ensure you’re running the correct version of `rspec` and `rubocop` + +#### All unit tests + +First, navigate into the root of the _fastlane_ project and run all unit tests using + +``` +bundle exec rspec +``` + +#### Unit tests for one specific tool + +If you want to run tests only for one tool, use + +``` +bundle exec rspec [tool_name] +``` + +#### Unit tests in one specific test file + +If you know exactly which `_spec.rb` file you want to run, use + +``` +bundle exec rspec ./fastlane/spec/fastlane_require_spec.rb +``` + +Replace `./fastlane/spec/fastlane_require_spec.rb` with the path of your test file of course. + +#### Specific unit test (group) in a specific test file + +If you know the specific unit test or unit test group you want to run, use + +``` +bundle exec rspec ./fastlane/spec/fastlane_require_spec.rb:17 +``` + +The number is the line number of the unit test (`it ... do`) or unit test group (`describe ... do`) you want to run. + +Instead of using the line number you can also use a filter with the `it "something", now: true` notation and then use `bundle exec rspec -t now` to run this tagged test. (Note that `now` can be any random string of your choice.) + +### Code style + +To verify and auto-fix the code style + +``` +bundle exec rubocop -a +``` + +If you want to run code style verification only for one tool, use `bundle exec rubocop -a [tool_name]` + + + +## Test your local _fastlane_ code base with your setup + +After introducing some changes to the _fastlane_ source code, you probably want to test the changes for your application. The easiest way to do so it use [bundler](https://bundler.io/). + +Copy the Gemfile [.assets/Gemfile](.assets/Gemfile) from your local _fastlane_ clone and drop it into your project's root folder. + +Make sure to replace `` with the path to your _fastlane_ clone, e.g. `~/fastlane`, then you can run +``` +bundle update +``` +in your project’s root directory. After doing so, you can verify you’re using the local version by running + +``` +bundle show fastlane +``` + +which should print out the path to your local development environment. + +From now on, every time you introduce a change to your local _fastlane_ code base, you can immediately test it by running `bundle exec fastlane …`. (Note that just using `fastlane …` without `bundle exec` will **not** use your local _fastlane_ code base!) + +If you want to run a command with your normal _fastlane_ installation, simply do not run the command with the `bundle exec` prefix. + +To fully remove your local _fastlane_ from your local project again, delete the `Gemfile` you created above. diff --git a/ToolsAndDebugging.md b/ToolsAndDebugging.md index ac5666ea981..4ad1326fb4a 100644 --- a/ToolsAndDebugging.md +++ b/ToolsAndDebugging.md @@ -1,6 +1,6 @@ # Tooling and Debugging -For detailed instructions on how to get started with contributing to _fastlane_, first check out [YourFirstPR.md][first-pr]. This guide will focus on more advanced instructions on how to debug _fastlane_ and _spaceship_ issues and work on patches. +For detailed instructions on how to get started with contributing to _fastlane_, first check out [YourFirstPR.md][first-pr] and [Testing.md](Testing.md). This guide will focus on more advanced instructions on how to debug _fastlane_ and _spaceship_ issues and work on patches. ## Debug using [pry](http://pryrepl.org/) @@ -28,32 +28,6 @@ DEBUG=1 bundle exec rspec You will then jump into an interactive debugger that allows you to print out variables, call methods and [much more](https://github.com/pry/pry/wiki). To continue running the original script use `control` + `d` - - -## Test your local _fastlane_ code base with your setup - -After introducing some changes to the _fastlane_ source code, you probably want to test the changes for your application. The easiest way to do so it use [bundler](https://bundler.io/). - -Copy the Gemfile [.assets/Gemfile](.assets/Gemfile) from your local _fastlane_ clone and drop it into your project's root folder. - -Make sure to replace `` with the path to your _fastlane_ clone, e.g. `~/fastlane`, then you can run -``` -bundle update -``` -in your project’s root directory. After doing so, you can verify you’re using the local version by running - -``` -bundle show fastlane -``` - -which should print out the path to your local development environment. - -From now on, every time you introduce a change to your local _fastlane_ code base, you can immediately test it by running `bundle exec fastlane …`. (Note that just using `fastlane …` without `bundle exec` will **not** use your local _fastlane_ code base!) - -If you want to run a command with your normal _fastlane_ installation, simply do not run the command with the `bundle exec` prefix. - -To fully remove your local _fastlane_ from your local project again, delete the `Gemfile` you created above. - ## Debugging and patching _[spaceship](https://spaceship.airforce)_ issues ### Introduction to _spaceship_ diff --git a/YourFirstPR.md b/YourFirstPR.md index fccf7fc17df..196acf5a079 100644 --- a/YourFirstPR.md +++ b/YourFirstPR.md @@ -26,95 +26,9 @@ If you want to work on something else, e.g. new functionality or fixing a bug, i - A good name for a branch describes the thing you’ll be working on, e.g. `docs-fixes`, `fix-deliver-upload`, `gym-build-android-app`, etc. - That’s it! Now you’re ready to work on _fastlane_ -## Testing your local changes +## Testing your changes -### Checking it all - -The `Fastfile` included at the top of the fastlane project allows you to run several validation steps, such as automated tests, code style and more. - -``` -bundle exec fastlane test -``` - -You can also run those steps independently or on a more fine grained way. - -### Automated tests - -Make sure to run the automated tests using `bundle exec` to ensure you’re running the correct version of `rspec` and `rubocop` - -#### All unit tests - -First, navigate into the root of the _fastlane_ project and run all unit tests using - -``` -bundle exec rspec -``` - -#### Unit tests for one specific tool - -If you want to run tests only for one tool, use - -``` -bundle exec rspec [tool_name] -``` - -#### Unit tests in one specific test file - -If you know exactly which `_spec.rb` file you want to run, use - -``` -bundle exec rspec ./fastlane/spec/fastlane_require_spec.rb -``` - -Replace `./fastlane/spec/fastlane_require_spec.rb` with the path of your test file of course. - -#### Specific unit test (group) in a specific test file - -If you know the specific unit test or unit test group you want to run, use - -``` -bundle exec rspec ./fastlane/spec/fastlane_require_spec.rb:17 -``` - -The number is the line number of the unit test (`it ... do`) or unit test group (`describe ... do`) you want to run. - -Instead of using the line number you can also use a filter with the `it "something", now: true` notation and then use `bundle exec rspec -t now` to run this tagged test. (Note that `now` can be any random string of your choice.) - -### Code style - -To verify and auto-fix the code style - -``` -bundle exec rubocop -a -``` - -If you want to run code style verification only for one tool, use `bundle exec rubocop -a [tool_name]` - - - -## Test your local _fastlane_ code base with your setup - -After introducing some changes to the _fastlane_ source code, you probably want to test the changes for your application. The easiest way to do so it use [bundler](https://bundler.io/). - -Copy the Gemfile [.assets/Gemfile](.assets/Gemfile) from your local _fastlane_ clone and drop it into your project's root folder. - -Make sure to replace `` with the path to your _fastlane_ clone, e.g. `~/fastlane`, then you can run -``` -bundle update -``` -in your project’s root directory. After doing so, you can verify you’re using the local version by running - -``` -bundle show fastlane -``` - -which should print out the path to your local development environment. - -From now on, every time you introduce a change to your local _fastlane_ code base, you can immediately test it by running `bundle exec fastlane …`. (Note that just using `fastlane …` without `bundle exec` will **not** use your local _fastlane_ code base!) - -If you want to run a command with your normal _fastlane_ installation, simply do not run the command with the `bundle exec` prefix. - -To fully remove your local _fastlane_ from your local project again, delete the `Gemfile` you created above. +[Testing _fastlane_](Testing.md) is so important, that the instructions have their own documentation file. They include [how to test your local changes](Testing.md#testing-your-local-changes) and [how to test your local fastlane code base with your setup](Testing.md#test-your-local-fastlane-code-base-with-your-setup). ## Submitting the PR