How many API tokens/keys do I need?
Each knapsack_pro command defined in the CI pipeline should use an individual API token. The purpose of an API token is to track a set of tests. When you run 2 different sets of tests within the same test suite then you need separate API tokens (for instance you run separately unit tests and feature tests).
Here are examples:
- Step 1.
bundle exec rake knapsack_pro:cucumber
- Step 2.
bundle exec rake knapsack_pro:rspec
- Step 3.
KNAPSACK_PRO_TEST_FILE_PATTERN="spec/features/*_spec.rb" bundle exec rake knapsack_pro:rspec
- Step 4.
bundle exec rake knapsack_pro:rspec[--tag tagA]
- Step 5.
bundle exec rake knapsack_pro:rspec[--tag ~tagA]
- Step 6.
bundle exec rake knapsack_pro:queue:rspec
- If you specified
KNAPSACK_PRO_TEST_FILE_PATTERNthen you run a subset of your whole test suite hence you need a separate API token because we want to track only tests for this set of tests.
- If you pass
--tag ~tagAthen you run a subset of your whole test suite hence you need a separate API token.
- If you use Regular Mode or Queue Mode then you need a separate API token for each mode.
When you run the same test suite for the different environments then you need multiple API tokens.
Let's say you have a single RSpec test suite and you would like to run it concurrently against different environments like mobile and desktop then you should generate separate API tokens like "RSpec Mobile" and "RSpec Desktop".
When you run the same test suite in steps on the CI server then you need multiple API tokens.
For instance, you run only unit tests and as a second step only integration tests. For each unique test file pattern defined with
KNAPSACK_PRO_TEST_FILE_PATTERN you need a separate API token.