Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make minitest stop execution on failure?

I am using Minitest as the runner for my functional tests, using Selenium as the driver to run the browser. Each test is modeled as MiniTest::Unit::TestCase.

Minitest reports summary of execution when it completes executing all tests. The Exceptions that were encountered are also printed towards the end of the execution. I find it difficult to debug when something unexpected fails as the context of execution is lost. The exceptions I am running into are not deterministic.

Is there a way to make Minitest runner to stop execution of tests on exception or assertion failure?

I am using minitest (2.11.2) and ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

like image 995
wanderer Avatar asked Mar 09 '12 01:03

wanderer


2 Answers

try rails test -f will do it. It means abort test run of first failure or error.

like image 61
r31n4ard Avatar answered Nov 15 '22 23:11

r31n4ard


Use -f.

In pure ruby, as you ask for, this means ruby <file> -f.

In rails, this means rails test -f.

Minitest will check the terminal's arguments for the -f flag, so how you call it appears to not be relevant to the -f flag.

like image 21
RWDJ Avatar answered Nov 15 '22 23:11

RWDJ