Knapsack Pro

Check out the new docs for the updated documentation.

FAQ / knapsack_pro / General questions for knapsack_pro gem

How to retry failed tests (flaky tests)?

Flaky (nondeterministic) tests, are tests that exhibit both a passing and a failing result with the same code.

I recommend to use rspec-retry gem that can retry failing test. It can be useful for randomly failing features specs. For instance you can configure it to retry 3 times features test before marking it as failing.

Alternative way is to use built into RSpec only failures option to rerun failed tests.

Please add to your RSpec configuration:


RSpec.configure do |c|
  c.example_status_persistence_file_path = "tmp/rspec_examples.txt"
end

Then you can execute rspec with only failed tests after main knapsack_pro command finish.


# Run knapsack_pro in Queue Mode and it will save failed tests in tmp/rspec_examples.txt
bundle exec rake knapsack_pro:queue:rspec

# run only failed tests from tmp/rspec_examples.txt
bundle exec rspec --only-failures

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

Start using Knapsack Pro

Sign up and speed up your tests.

Get started free