FAQ / knapsack_pro / General questions for knapsack_pro gem

How to require different Cucumber config files in isolation?

By default, the knapsack_pro gem requires all files from your test directory (the features directory). If you have multiple config files in your features/support/ directory, then all the config files will be loaded and may interfere with each other.

In order to use two different config files in isolation, you need to specify a path to the config file with KNAPSACK_PRO_TEST_DIR environment variable:

export KNAPSACK_PRO_TEST_DIR="features/support/cucumber_config_1.rb"
bundle exec rake "knapsack_pro:queue:cucumber[--verbose]"

Please remember to require the knapsack_pro config in the features/support/cucumber_config_1.rb. You also need to do it for your second config file: features/support/cucumber_config_2.rb.

When might two different Cucumber config files be useful?

You may want to do that when you want a different configuration to be applied to specific sets of tests. For example, we could have separate configs for running user dashboard tests, and admin dashboard tests, like so:

User dashboard tests with the first config:

export KNAPSACK_PRO_TEST_DIR="features/support/cucumber_config_1.rb"
export KNAPSACK_PRO_TEST_FILE_PATTERN="features/user_dashboard/**{,/*/**}/*.feature"
bundle exec rake "knapsack_pro:queue:cucumber[--verbose]"

Admin dashboard tests using the second config:

export KNAPSACK_PRO_TEST_DIR="features/support/cucumber_config_2.rb"
export KNAPSACK_PRO_TEST_FILE_PATTERN="features/admin_dashboard/**{,/*/**}/*.feature"
bundle exec rake "knapsack_pro:queue:cucumber[--verbose]"

# General questions for knapsack_pro gem
See questions outside of this category

Start using Knapsack Pro

Sign up and speed up your tests.