Wilgnner / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Code coverage always reports 0% #283

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. I just ran a simple test
this is the config file:
load:
   - src/*.js
   - test/*.js

plugin:
   - "coverage"
     jar: "coverage.jar"
     module: "com.google.jstestdriver.coverage.CoverageModule"

2. run the genhtml to produce the report

The coverage.dat produced has always line#,0 for each line.

What is the expected output? What do you see instead?
The output coverage.dat should at least have a line with 1.

What version of the product are you using? On what operating system?
1.3.3c, Mac osx,

Please provide any additional information below.

Original issue reported on code.google.com by lemuellu...@gmail.com on 22 Oct 2011 at 9:05

GoogleCodeExporter commented 8 years ago
Please run with --runnerMode=DEBUG and attach the log.

Original comment by corbinrs...@gmail.com on 28 Dec 2011 at 9:18

GoogleCodeExporter commented 8 years ago
I used this config with jstd 1.3.4b and coverage 1.3.4b
------------

server: http://127.0.0.1:4242

load:
 - js/*.js

test:
 - test/*.js

plugin:
 - name: "coverage"
   jar: "/Users/arlenwalker/bin/plugins/coverage.jar"
   module: "com.google.jstestdriver.coverage.CoverageModule"

---------------------------

to produce the attached log on OSX Lion from the command line. Interesting 
thing is if I swap out jsTestDriver-1.3.4 for the 1.3.2 version, and do exactly 
the same thing, I get a real coverage report. So currently I test and debug 
using 1.3.4, then stop the server and run 1.3.2 when I want to check my 
coverage. This is tedious.

FWIW, here's what the 1.3.2 coverage reads, for the same codebase:

Total 44 tests (Passed: 44; Fails: 0; Errors: 0) (160.00 ms)
  Safari 534.55.3 Mac OS: Run 44 tests (Passed: 44; Fails: 0; Errors 0) (160.00 ms)
/Users/arlenwalker/Documents/Development/marshall/test/Board_images_test.js: 
100.0% covered
/Users/arlenwalker/Documents/Development/marshall/test/board_test.js: 100.0% 
covered
/Users/arlenwalker/Documents/Development/marshall/test/converter_test.js: 
100.0% covered
/Users/arlenwalker/Documents/Development/marshall/test/Move_test.js: 100.0% 
covered
/Users/arlenwalker/Documents/Development/marshall/test/My_move_test.js: 100.0% 
covered
/Users/arlenwalker/Documents/Development/marshall/test/My_square_test.js: 
100.0% covered
/Users/arlenwalker/Documents/Development/marshall/test/Pgn_test.js: 100.0% 
covered
/Users/arlenwalker/Documents/Development/marshall/test/v_square_test.js: 100.0% 
covered
/Users/arlenwalker/Documents/Development/marshall/js/Board.js: 0.37664783% 
covered
/Users/arlenwalker/Documents/Development/marshall/js/BoardImages.js: 54.166668% 
covered
/Users/arlenwalker/Documents/Development/marshall/js/Converter.js: 62.46246% 
covered
/Users/arlenwalker/Documents/Development/marshall/js/isYahoo.js: 33.333336% 
covered
/Users/arlenwalker/Documents/Development/marshall/js/Move.js: 100.0% covered
/Users/arlenwalker/Documents/Development/marshall/js/MyMove.js: 100.0% covered
/Users/arlenwalker/Documents/Development/marshall/js/MySquare.js: 100.0% covered
/Users/arlenwalker/Documents/Development/marshall/js/Pgn.js: 82.86853% covered
/Users/arlenwalker/Documents/Development/marshall/js/vSquare.js: 100.0% covered
/Users/arlenwalker/Documents/Development/marshall/js/Yahoo.js: 2.7027028% 
covered

So obviously something changed. It appears to have stopped working with 1.3.3c, 
while it worked with 1.3.3b (or at least the screen report seems good -- didn't 
check it with genhtml)

Original comment by arlen.wa...@gmail.com on 7 Apr 2012 at 4:18

Attachments:

GoogleCodeExporter commented 8 years ago
+1, code coverage in safari is not working

Original comment by ehu...@mobileiron.com on 5 Jul 2012 at 7:20

GoogleCodeExporter commented 8 years ago
I have been trying to get coverage data on 1.3.4-b and 1.3.5 with no luck

Original comment by mahe...@gmail.com on 8 Nov 2012 at 12:07

GoogleCodeExporter commented 8 years ago
BTW, I'm using PhantomJS in a CI environment with ant

Original comment by mahe...@gmail.com on 8 Nov 2012 at 12:42

GoogleCodeExporter commented 8 years ago
I'm seeing the same thing as well. I can get code coverage to work with 1.3.3b 
but nothing after 1.3.3c. Using phantomJS on Ubuntu.

Original comment by benjamin...@gmail.com on 11 Dec 2012 at 6:07

GoogleCodeExporter commented 8 years ago
The code coverage always reports 0 only in safari (Version 6.0.4) browser .. 
I'm using coverage plugin version 1.3.5 on Mac OS X 10.8.3... The coverage 
report works fine with chrome (Version 26) browser..

Original comment by karthi...@gmail.com on 13 May 2013 at 11:50

GoogleCodeExporter commented 8 years ago
The code coverage reports 0% in safari because each javascript file's are 
loaded twice, so LCOV.js is getting executed again after running all the test 
scripts so the Reporter object gets reset and the process test results sending 
the POST request to the server with empty array for  linesCovered property.

[{"testCaseName":"dummy - 
module","testName":"test1","result":"passed","message":"","log":"","time":4,"dat
a":{"linesCovered":"[]"}}]

Anybody has an idea why the files are getting loaded twice ?

Original comment by karthi...@gmail.com on 17 May 2013 at 9:08