Skip to content

Instantly share code, notes, and snippets.

@jrafanie
Created March 12, 2015 16:02
Show Gist options
  • Save jrafanie/8256d85bd439b0750d7a to your computer and use it in GitHub Desktop.
Save jrafanie/8256d85bd439b0750d7a to your computer and use it in GitHub Desktop.
Using OSX's say and bash to find a rspec seed to recreate test order dependency bugs
#!/bin/bash
#
# usage:
# Pass the tests/directories you want to tests in random order:
# ./test_until_failure.sh spec/models"`
#
# For example, if you think the connections method is suspect:
# ./test_until_failure.sh `git grep -l connections spec/lib spec/models/ spec/controllers/ |grep "_spec.rb"`
for i in `seq 1 500`;
do
bundle exec rspec --order=random --format=progress --fail-fast $@
if [ $? -ne 0 ]
then
msg="$i FAILED!!! WAKE UP!!!"
say $msg
echo $msg
exit 1
else
msg="$i Passed."
say $msg
echo $msg
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment