JsTestDriver on NetBeans stops testing after a failed assertion
JavascriptNetbeansJs Test-DriverJavascript Problem Overview
I have set up JavaScript unit testing with JS Test Driver on Netbeans as per this Link. However, unlike the results in that tutorial, no more tests are executed after an assertion fails. How can I change this behaviour?
For example, given this test file:
The test.js
file:
AssertionsTestCase = TestCase("AssertionsTestCase");
AssertionsTestCase.prototype.testAlwaysPass = function(){
assertEquals(1, 1);
assertEquals(2, 2);
};
AssertionsTestCase.prototype.testAlwaysFail1 = function(){
assertEquals(1, 2);
};
AssertionsTestCase.prototype.testAlwaysFail2 = function(){
assertEquals(3, 4);
};
the progress bar shows 50%, (2 tests), it should say 33%.
The jsTestDriver.conf
file:
server: http://localhost:42442
load:
- test/lib/jasmine/jasmine.js
- test/lib/jasmine-jstd-adapter/JasmineAdapter.js
- test/unit/*.js
I can have all tests run by command line. (On Windows PowerShell). Running as follows, tests do not stop running after a failure:
> java -jar $env:JSTD\JsTestDriver-1.3.5.jar --tests all --config jsTestDriver.conf
the jsTestDriver.conf
file:
server: http://localhost:4244
load:
- test/lib/jasmine/jasmine.js
- test/lib/jasmine-jstd-adapter/JasmineAdapter.js
- test/unit/*.js
All three tests are run.
Javascript Solutions
Solution 1 - Javascript
Seems like in Chrome works fine.
Regarding Firefox as in comment said it is not correct answer. I have managed to get it work partially. The issue is how netbeans handle failed tests and how jstestdriver.jar is started. I know this doesn't solve issue but it is pointing in right direction.
Steps to reproduce this.
- Start JS Test Driver from Services
- Run test.
- Since I am using linux. I have located jstestdriver.properties from Netbeans configuration folder for current user. In my case it is located in
/home/{user}/.netbeans/8.2/config/Preferences/org/netbeans/modules/javascript/jstestdriver.properties
Edit location property by adding arguments to jstestdriver.jar --tests all --reset. After editing my properties looks like this.
`location=/home/user/Downloads/jstestdriver-1.3.5.jar --tests all --reset
server.url=http://localhost:42442
strict.mode=false
use.browser.ANDROID_DEVICE_CHROME=false
use.browser.ANDROID_DEVICE_DEFAULT=false
use.browser.ANDROID_EMULATOR_DEFAULT=false
use.browser.Chrome=false
use.browser.Chrome.INTEGRATED=false
use.browser.SL__Browsers_FirefoxBrowser=true
use.browser.SL__Browsers_MozillaBrowser=false`
4. Repeat 2 times. - Restart JS Test Driver from Services. - Run test.
After second restart and run, it should run all tests as in picture above. If you can add arguments --tests all --reset for JS Test Driver in Netbeans it should solve issue to work as in Chrome.