登录

NetBeans上的JSTestDriver在failed assertion后停止testing

1970-01-01 ·JavaScript

NetBeans,JSTestDriver,failed assertion,testing

我已经根据这个链接在NETBeaS上用JS测试驱动程序设置了JavaScript单元测试。

但是结果不同,failed assertion后不再执行任何testing。

test.js文件:


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);
};
进度条显示50%,(2个测试),应该是33%。


jstestdriver.conf文件:


server: http://localhost:42442
load:
  - test/lib/jasmine/jasmine.js
  - test/lib/jasmine-jstd-adapter/JasmineAdapter.js
  - test/unit/*.js
可以通过命令行运行所有测试。(在Windows PowerShell上)。按如下方式运行,测试不会在失败后停止运行:

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

所有三个测试都运行。


你用另一个浏览器试过了吗?因为它在命令行中工作,所以我假设失败是由NetBeans或浏览器造成的。–Silu 8月24日16:9:45

jasmine --stop-on-failure=false jasmine.github.io/2.5/node.html#section-21 – Luke May 26 "17 at 13:58 





Chrome 效果不错

Firefox 结果错误的

已经设法使它部分地工作了。问题是NetBeans如何处理失败的测试以及jstestDriver.jar如何启动。我知道这不能解决问题,但它指向了正确的方向。

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.


在第二次重新启动并运行之后,它应该运行如上图所示的所有测试。如果您可以在netbeans中为JS测试驱动程序添加参数tests all reset,那么应该像在chrome中一样解决这个问题。


· END ·

TAG:NetBeans,JSTestDriver,failed assertion,testing 来源:网络

热门标签

首页 - 导航 - 免责 - 官方微信 - 用户反馈

© 2019 GOODTEXT.CN