7

We're getting intermittent failures.

Hope can I run one test 100 times to see how 'stable' it is?

2 Answers 2

12

If you are using zsh shell:

repeat 10 { command }

On basic shell:

for _ in {1..10} do command; done

If you can run the tests in parallel, you can use the GNU Parallel:

parallel command ::: {1..1000}

Tutorial videos: https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1

Text tutorial: http://www.gnu.org/software/parallel/parallel_tutorial.html

Your test framework probably has some functionality to rerun failed tests. Behat, for instance, has a --rerun option.

2

Create a script in your home directory, e.g.

  $ cat run_spec_100_times.sh

    cd ~/eq/lynx
    for i in `seq 1 100`;
      do
        rspec spec/features/survey_spec.rb
      done
    cd ~

Modify the script to be executable with chmod +x run_spec_100_times.sh

The use it with . run_spec_100_times.sh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.