简体   繁体   English

对如何使用 JScover 感到困惑

[英]Confused about how to use JScover

I need to check the test coverage in my Jscript application.我需要检查我的 Jscript 应用程序中的测试覆盖率。 I am using Qunit as unit test framework.我使用 Qunit 作为单元测试框架。 I cannot make Jscover works properly.我无法让 Jscover 正常工作。 I haven't understood how should I use it, which command I should issue and which directories I have to specify in the path.我不明白我应该如何使用它,我应该发出哪个命令以及我必须在路径中指定哪些目录。

This is the structure of my file system :这是我的文件系统的结构:

JSON/ 
css/
html/
images/  
js/
test/
index.html  

The code I want to test is in the js folder, while the qunit test are in the test folder.我要测试的代码在 js 文件夹中,而 qunit 测试在 test 文件夹中。

You can post this as a question at https://github.com/tntim96/JSCover/issues , but will try to answer here...您可以在https://github.com/tntim96/JSCover/issues将此作为问题发布,但会尝试在此处回答...

If you run the tests by pointing your browser at the 'index.html' file, and assuming that is in the directory 'c:/your-test-directory', you can run it via the server mode.如果您通过将浏览器指向“index.html”文件来运行测试,并假设它位于目录“c:/your-test-directory”中,则可以通过服务器模式运行它。 For example:例如:

java -jar target/dist/JSCover.jar -ws --branch --document-root=c:/your-test-directory --report-dir=target --no-instrument=test --no-instrument=js/lib

I've added '--no-instrument=js/lib' to illustrate how to exclude 3rd party libraries, such as JQuery, from instrumentation.我添加了“--no-instrument=js/lib”来说明如何从检测中排除第三方库,例如 JQuery。

Then point your browser at http://localhost:8080/jscoverage.html?/index.html然后将浏览器指向http://localhost:8080/jscoverage.html?/index.html

There is more information in the manual too.手册中也有更多信息。 Let me know how you go.让我知道你怎么去。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM