JsTestDriver on NetBeans stops testing after a failed assertion
Asked Answered
C

1

177

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%.

enter image description here

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.

Countess answered 9/8, 2016 at 17:6 Comment(4)
Did you try it with another browser? Since it is working from the command line, I assume the failure is caused by netbeans or the browser.Betsey
will this help you? jasmine --stop-on-failure=false jasmine.github.io/2.5/node.html#section-21Gemmation
Maybe the comments here can help #22119693Hargreaves
I think netbeans test handling is buggy, at least with Mocha.Briquette
M
2

Seems like in Chrome works fine. enter image description here

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.

enter image description here

Steps to reproduce this.

  1. Start JS Test Driver from Services
  2. Run test.
  3. 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.

Moulmein answered 19/11, 2017 at 19:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.