Skip to content

Instantly share code, notes, and snippets.

@sigmavirus24
Created September 5, 2013 02:33
Show Gist options
  • Save sigmavirus24/6445383 to your computer and use it in GitHub Desktop.
Save sigmavirus24/6445383 to your computer and use it in GitHub Desktop.

How to feel good about your tests

Does writing tests and seeing them fail have you down? Add this new and improved test runner to your testing methodology and see your test runs improve.

#!/bin/sh
for ((i=0; i<$RANDOM; i++)); do echo -n '.' ; done ; echo ; echo '==== TESTS PASSED ====' ; echo 'Tests ran in 0.00s'

This one line will cure all your worries. Simply save it as a file called run_tests and run chmod 755 run_tests. Then whenever your tests have you down, run ./run_tests from the command line and see green.


Disclaimer

run_tests does not actually run any tests and is not a continuous integration solution. Do not use run_tests if you are under the age of 13 or trying to impress your boss. Also, never use run_tests in a TDD environment, you will end up with no tests then.

@Mudpuppy12
Copy link

This code has saved my life. Thank you for this snippet. I was so depressed with my testing it was affecting my health. After using this script I've lost 30lbs, got a new outlook on life, and soon will marry a movie star.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment