Selenium:是否有任何我们可以与Selenium Server / RC集成的JS(JavaScript)代码覆盖工具

问题描述:

Selenium:是否有任何我们可以与Selenium Server / RC集成的JS(JavaScript)代码覆盖工具

Selenium: Is there any JS (JavaScript) code coverage tool which we can integrate with Selenium Server/RC

我想通过我的Selenium测试套件完成JS代码覆盖

I want to JS code coverage done by my Selenium Test Suite

是否有可以与我现有的elenet rc框架集成的代码覆盖工具? ?

Is there any code coverage tool which can be integrated with my existing selenium rc framework??

我已经找到了满足我需要的解决方案,可以使用多种工具,但是我希望可以将其与我现有的自动化系统很容易

I have found the solution for my need, there are multiple tools available but I want a tool which can be integrated with my existing automation easily

工具是JSCover
http://tntim96.github.io/JSCover/

Tool is JSCover http://tntim96.github.io/JSCover/

只需运行服务器


  1. 运行服务器
    java -cp JSCover-all.jar jscover.server.SimpleWebServer。 8080

  2. 运行代理服务器
    java -jar target / dist / JSCover-all.jar -ws --proxy --port = 3128 --report-dir = target

  1. Run Server java -cp JSCover-all.jar jscover.server.SimpleWebServer . 8080
  2. Run Proxy Server java -jar target/dist/JSCover-all.jar -ws --proxy --port=3128 --report-dir=target

在Webdriver中为指定的端口添加代理,在我的情况下为3128

Add Proxy in your Webdriver for port specified, 3128 in my case

执行测试后,使用

((JavascriptExecutor) driver).executeScript("jscoverage_report();");


您可以在退出WebDriver的位置添加此行或测试用例

You can add this line where you exit WebDriver or Test Case