Just want to know if it's possible to force casperjs to only output failed tests to the console. Has anyone tried to do that?
Thank you
Just want to know if it's possible to force casperjs to only output failed tests to the console. Has anyone tried to do that?
Thank you
Since you're running the CasperJS test environment, you can add the --concise option when you run CasperJS:
casperjs test --concise yourTest.js This hides all assertion logs, but doesn't hide the additional info of FAILs:
Test file: test20_only_show_fail.js # type: assert # file: test20_only_show_fail.js:8 # code: test.assert(false, "false"); # subject: false # type: assert # file: test20_only_show_fail.js:13 # code: test.assert(false, "false"); # subject: false FAIL 3 tests executed in 0.027s, 1 passed, 2 failed, 0 dubious, 0 skipped.
But now you can't distinguish them easily. You can add an event listener to the front of your test file and let it print something useful:
casper.test.on("fail", function(failure) { this.casper.echo("FAIL " + failure.message); }); This produces the FAIL lines that come after the additional information:
Test file: test20_only_show_fail.js # type: assert # file: test20_only_show_fail.js:7 # code: test.assert(false, "false"); # subject: false FAIL false # type: assert # file: test20_only_show_fail.js:12 # code: test.assert(false, "false"); # subject: false FAIL false FAIL 3 tests executed in 0.028s, 1 passed, 2 failed, 0 dubious, 0 skipped.
This is the test file (test20_only_show_fail.js) for reference:
casper.test.on("fail", function(failure) { this.casper.echo("FAIL " + failure.message); }); casper.test.begin('fail test', function(test) { test.assert(true, "true"); test.assert(false, "false"); test.assert(true, "true (2)"); }); casper.test.begin('error test', function(test) { test.assert(false, "false"); });