We're getting intermittent failures.

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

2 Answers 2


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.


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

  $ cat run_spec_100_times.sh

    cd ~/eq/lynx
    for i in `seq 1 100`;
        rspec spec/features/survey_spec.rb
    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 you have read our privacy policy.

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