FAQ / knapsack_pro / General questions for knapsack_pro gem

How to run a specific list of test files or only some tests from test file?

Note: If you don't want to use the pattern KNAPSACK_PRO_TEST_FILE_PATTERN (see) to define a list of tests to run then read below two options.

Option 1 - read a list of test files from env var

If you want to run a specific list of test files that are explicitly defined by you or auto-generated by some kind of script you created then please use:


Note KNAPSACK_PRO_TEST_FILE_LIST must be a list of test files comma separated. You can provide line number for tests inside of spec file in case of RSpec (this way you can run only one test or a group of tests from RSpec spec file). You can provide the same file a few times with different test line number.

Option 2 - read a list of test files from a source file

Similarly, you can also provide a source file containing the test files that you would like to run. This might be useful when you have a very large list of test files.

For example: KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=spec/fixtures/test_file_list_source_file.txt
And the content of the source file can be any of the format below:


Note that each of the line must be ending with \n the new line.


Note when you set KNAPSACK_PRO_TEST_FILE_LIST or KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE then below environment variables are ignored:


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

Start using Knapsack Pro

Sign up and speed up your tests.