高效的JavaScript代码单元测试方法(11)

发表于:2013-01-11来源:web开发社区作者:Hazem Saleh点击数: 标签:JavaScript
启动并捕获浏览器后,可以通过以下命令行运行测试用例类: 查看源代码 打印帮助 1 java -jar JsTestDriver-1.3.2.jar --tests all 运行命令后,您将看到第一轮结果

  启动并捕获浏览器后,可以通过以下命令行运行测试用例类:

  查看源代码

打印帮助
1 java -jar JsTestDriver-1.3.2.jar --tests all

  运行命令后,您将看到第一轮结果,如清单 6 所示。

  清单 6. 第一轮结果

  查看源代码

打印帮助
01 Total 9 tests (Passed: 6; Fails: 3; Errors: 0) (16.00 ms)
02   Firefox 3.6.18 Windows: Run 3 tests (Passed: 0; Fails: 3; Errors 0) (8.00 ms)
03     ApplicationUtilTest.testValidateLoginFormBothEmpty failed (3.00 ms): 
04     AssertError: Username is not validated correctly! expected "This field 
05     is required" but was "" Error ("Username is not validated correctly! 
06     expected \"This field is required\" but was \"\"")@:0()@http://localhost
07     :9876/test/js-test/TestApplicationUtil.js:16
08  
09     ApplicationUtilTest.testValidateLoginFormWithEmptyUserName failed (3.00 ms): 
10     AssertError: Username is not validated correctly! expected "This field is 
11     required" but was "" Error ("Username is not validated correctly! expected 
12     \"This field is required\" but was \"\"")@:0()@http://localhost:9876/test

原文转自:http://www.ltesting.net