Quantcast

Unit Tests and Code Coverage for Sonar JavaScript Plugin

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unit Tests and Code Coverage for Sonar JavaScript Plugin

Jebastin Prabaharan
Hi,

   When I execute sonar(using Maven) for JavaScript project provided under https://github.com/SonarSource/sonar-examples, the code coverage and unit tests are shown as zero, even though there are unit tests present. 

Does the JavaScript plugin requires any additional settings in order to use find coverage?

Regards,
-Jeb
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unit Tests and Code Coverage for Sonar JavaScript Plugin

David Racodon-2
Hi Jeb,

This example should not require any specific settings apart from them listed in the README file.
Could you send more information, so that we can help you?
  • Versions of Sonar, JavaSript plugin, Maven, etc.
  • Log files
  • Can you check if your tests reports have been generated in target/jstestdriver after running "mvn test"?

Thank you

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 13:34, Jebastin Prabaharan <[hidden email]> wrote:
Hi,

   When I execute sonar(using Maven) for JavaScript project provided under https://github.com/SonarSource/sonar-examples, the code coverage and unit tests are shown as zero, even though there are unit tests present. 

Does the JavaScript plugin requires any additional settings in order to use find coverage?

Regards,
-Jeb

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unit Tests and Code Coverage for Sonar JavaScript Plugin

Jebastin Prabaharan
Hi David,

   Please find the versions below,

Versions
  • Sonar - 3.1.1
  • JavaScript Plugin - 1.0
  • Maven - 3.0.3
I have attached the log files.

I ran "mvn sonar:sonar" and the test files are not found under the reports. I was under impression that "mvn sonar:sonar internally runs the unit test. 

When I try to run the "mvn test" after changing the browser path in the pom to "/Applications/Google Chrome.app" the tests are failing with the following exception stack.


Running: java -classpath /Users/jeb/.m2/repository/com/googlecode/jstd-maven-plugin/jstd-maven-plugin/1.3.2.5/jstd-maven-plugin-1.3.2.5.jar;/Users/jeb/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar;/Users/jeb/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar;/Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.0-beta-3.0.1/plexus-component-annotations-1.0-beta-3.0.1.jar;/Users/jeb/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar;/Users/jeb/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar;/Users/jeb/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar;/Users/jeb/.m2/repository/com/google/code/google-collections/google-collect/snapshot-20080530/google-collect-snapshot-20080530.jar;/Users/jeb/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar;/Users/jeb/.m2/repository/org/apache/maven/artifact/maven-artifact/3.0-alpha-1/maven-artifact-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.jar;/Users/jeb/.m2/repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar;/Users/jeb/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.6/wstx-asl-3.2.6.jar;/Users/jeb/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar;/Users/jeb/.m2/repository/org/sonatype/spice/model-builder/1.0/model-builder-1.0.jar;/Users/jeb/.m2/repository/org/apache/maven/maven-project-builder/3.0-alpha-1/maven-project-builder-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/jvnet/wagon-svn/wagon-svn/1.8/wagon-svn-1.8.jar;/Users/jeb/.m2/repository/org/jvnet/hudson/svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar;/Users/jeb/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar -jar /Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar --basePath /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver --browser /Applications/Google Chrome.app --captureConsole --config /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver/src/test/resources/jsTestDriver.conf --port 9876 --testOutput target/jstestdriver --tests all --verbose
Failures during test run.
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:62)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at com.google.jstestdriver.browser.CommandLineBrowserRunner.stopBrowser(CommandLineBrowserRunner.java:56)
at com.google.jstestdriver.browser.BrowserControl.stopBrowser(BrowserControl.java:79)
at com.google.jstestdriver.browser.BrowserCallable.call(BrowserCallable.java:30)
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:49)
... 10 more

at com.google.jstestdriver.browser.BrowserActionExecutorAction.run(BrowserActionExecutorAction.java:142)
at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:64)
at com.google.jstestdriver.JsTestDriver.main(JsTestDriver.java:86)
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
Unexpected Runner Condition: Failures during test run.
 Use --runnerMode DEBUG for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.886s
[INFO] Finished at: Wed Jul 04 19:14:55 GMT+05:30 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.googlecode.jstd-maven-plugin:jstd-maven-plugin:1.3.2.5:test (run-tests) on project javascript-maven-JsTestDriver: Failed to parse results -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
Jebastins-MacBook-Pro:javascript-maven-JsTestDriver jeb$ mvn test


Regards,
-Jeb

On Wed, Jul 4, 2012 at 6:29 PM, David Racodon <[hidden email]> wrote:
Hi Jeb,

This example should not require any specific settings apart from them listed in the README file.
Could you send more information, so that we can help you?
  • Versions of Sonar, JavaSript plugin, Maven, etc.
  • Log files
  • Can you check if your tests reports have been generated in target/jstestdriver after running "mvn test"?

Thank you

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 13:34, Jebastin Prabaharan <[hidden email]> wrote:
Hi,

   When I execute sonar(using Maven) for JavaScript project provided under https://github.com/SonarSource/sonar-examples, the code coverage and unit tests are shown as zero, even though there are unit tests present. 

Does the JavaScript plugin requires any additional settings in order to use find coverage?

Regards,
-Jeb




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

log.txt (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unit Tests and Code Coverage for Sonar JavaScript Plugin

David Racodon-2
Hi Jeb,

OK, so the issue is on jtestdriver side, not Sonar.
On Mac, it seems that the path to Chrome would be more like /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.
I'll let you give a try and then dig into the jtestdriver documentation if it does not solve your issue.

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 15:48, Jebastin Prabaharan <[hidden email]> wrote:
Hi David,

   Please find the versions below,

Versions
  • Sonar - 3.1.1
  • JavaScript Plugin - 1.0
  • Maven - 3.0.3
I have attached the log files.

I ran "mvn sonar:sonar" and the test files are not found under the reports. I was under impression that "mvn sonar:sonar internally runs the unit test. 

When I try to run the "mvn test" after changing the browser path in the pom to "/Applications/Google Chrome.app" the tests are failing with the following exception stack.


Running: java -classpath /Users/jeb/.m2/repository/com/googlecode/jstd-maven-plugin/jstd-maven-plugin/1.3.2.5/jstd-maven-plugin-1.3.2.5.jar;/Users/jeb/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar;/Users/jeb/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar;/Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.0-beta-3.0.1/plexus-component-annotations-1.0-beta-3.0.1.jar;/Users/jeb/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar;/Users/jeb/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar;/Users/jeb/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar;/Users/jeb/.m2/repository/com/google/code/google-collections/google-collect/snapshot-20080530/google-collect-snapshot-20080530.jar;/Users/jeb/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar;/Users/jeb/.m2/repository/org/apache/maven/artifact/maven-artifact/3.0-alpha-1/maven-artifact-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.jar;/Users/jeb/.m2/repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar;/Users/jeb/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.6/wstx-asl-3.2.6.jar;/Users/jeb/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar;/Users/jeb/.m2/repository/org/sonatype/spice/model-builder/1.0/model-builder-1.0.jar;/Users/jeb/.m2/repository/org/apache/maven/maven-project-builder/3.0-alpha-1/maven-project-builder-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/jvnet/wagon-svn/wagon-svn/1.8/wagon-svn-1.8.jar;/Users/jeb/.m2/repository/org/jvnet/hudson/svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar;/Users/jeb/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar -jar /Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar --basePath /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver --browser /Applications/Google Chrome.app --captureConsole --config /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver/src/test/resources/jsTestDriver.conf --port 9876 --testOutput target/jstestdriver --tests all --verbose
Failures during test run.
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:62)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at com.google.jstestdriver.browser.CommandLineBrowserRunner.stopBrowser(CommandLineBrowserRunner.java:56)
at com.google.jstestdriver.browser.BrowserControl.stopBrowser(BrowserControl.java:79)
at com.google.jstestdriver.browser.BrowserCallable.call(BrowserCallable.java:30)
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:49)
... 10 more

at com.google.jstestdriver.browser.BrowserActionExecutorAction.run(BrowserActionExecutorAction.java:142)
at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:64)
at com.google.jstestdriver.JsTestDriver.main(JsTestDriver.java:86)
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
Unexpected Runner Condition: Failures during test run.
 Use --runnerMode DEBUG for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.886s
[INFO] Finished at: Wed Jul 04 19:14:55 GMT+05:30 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.googlecode.jstd-maven-plugin:jstd-maven-plugin:1.3.2.5:test (run-tests) on project javascript-maven-JsTestDriver: Failed to parse results -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
Jebastins-MacBook-Pro:javascript-maven-JsTestDriver jeb$ mvn test


Regards,
-Jeb

On Wed, Jul 4, 2012 at 6:29 PM, David Racodon <[hidden email]> wrote:
Hi Jeb,

This example should not require any specific settings apart from them listed in the README file.
Could you send more information, so that we can help you?
  • Versions of Sonar, JavaSript plugin, Maven, etc.
  • Log files
  • Can you check if your tests reports have been generated in target/jstestdriver after running "mvn test"?

Thank you

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 13:34, Jebastin Prabaharan <[hidden email]> wrote:
Hi,

   When I execute sonar(using Maven) for JavaScript project provided under https://github.com/SonarSource/sonar-examples, the code coverage and unit tests are shown as zero, even though there are unit tests present. 

Does the JavaScript plugin requires any additional settings in order to use find coverage?

Regards,
-Jeb




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unit Tests and Code Coverage for Sonar JavaScript Plugin

Jebastin Prabaharan
Thanks David :) 

I have corrected the path and tests are successful. And the test coverage is shown correctly. 

But why sonar does not run the tests unlike Java Projects where the Junits are run internally.

Regards,
-Jeb

On Wed, Jul 4, 2012 at 7:51 PM, David Racodon <[hidden email]> wrote:
Hi Jeb,

OK, so the issue is on jtestdriver side, not Sonar.
On Mac, it seems that the path to Chrome would be more like /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.
I'll let you give a try and then dig into the jtestdriver documentation if it does not solve your issue.

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 15:48, Jebastin Prabaharan <[hidden email]> wrote:
Hi David,

   Please find the versions below,

Versions
  • Sonar - 3.1.1
  • JavaScript Plugin - 1.0
  • Maven - 3.0.3
I have attached the log files.

I ran "mvn sonar:sonar" and the test files are not found under the reports. I was under impression that "mvn sonar:sonar internally runs the unit test. 

When I try to run the "mvn test" after changing the browser path in the pom to "/Applications/Google Chrome.app" the tests are failing with the following exception stack.


Running: java -classpath /Users/jeb/.m2/repository/com/googlecode/jstd-maven-plugin/jstd-maven-plugin/1.3.2.5/jstd-maven-plugin-1.3.2.5.jar;/Users/jeb/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar;/Users/jeb/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar;/Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.0-beta-3.0.1/plexus-component-annotations-1.0-beta-3.0.1.jar;/Users/jeb/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar;/Users/jeb/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar;/Users/jeb/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar;/Users/jeb/.m2/repository/com/google/code/google-collections/google-collect/snapshot-20080530/google-collect-snapshot-20080530.jar;/Users/jeb/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar;/Users/jeb/.m2/repository/org/apache/maven/artifact/maven-artifact/3.0-alpha-1/maven-artifact-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.jar;/Users/jeb/.m2/repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar;/Users/jeb/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.6/wstx-asl-3.2.6.jar;/Users/jeb/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar;/Users/jeb/.m2/repository/org/sonatype/spice/model-builder/1.0/model-builder-1.0.jar;/Users/jeb/.m2/repository/org/apache/maven/maven-project-builder/3.0-alpha-1/maven-project-builder-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/jvnet/wagon-svn/wagon-svn/1.8/wagon-svn-1.8.jar;/Users/jeb/.m2/repository/org/jvnet/hudson/svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar;/Users/jeb/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar -jar /Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar --basePath /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver --browser /Applications/Google Chrome.app --captureConsole --config /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver/src/test/resources/jsTestDriver.conf --port 9876 --testOutput target/jstestdriver --tests all --verbose
Failures during test run.
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:62)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at com.google.jstestdriver.browser.CommandLineBrowserRunner.stopBrowser(CommandLineBrowserRunner.java:56)
at com.google.jstestdriver.browser.BrowserControl.stopBrowser(BrowserControl.java:79)
at com.google.jstestdriver.browser.BrowserCallable.call(BrowserCallable.java:30)
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:49)
... 10 more

at com.google.jstestdriver.browser.BrowserActionExecutorAction.run(BrowserActionExecutorAction.java:142)
at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:64)
at com.google.jstestdriver.JsTestDriver.main(JsTestDriver.java:86)
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
Unexpected Runner Condition: Failures during test run.
 Use --runnerMode DEBUG for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.886s
[INFO] Finished at: Wed Jul 04 19:14:55 GMT+05:30 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.googlecode.jstd-maven-plugin:jstd-maven-plugin:1.3.2.5:test (run-tests) on project javascript-maven-JsTestDriver: Failed to parse results -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
Jebastins-MacBook-Pro:javascript-maven-JsTestDriver jeb$ mvn test


Regards,
-Jeb

On Wed, Jul 4, 2012 at 6:29 PM, David Racodon <[hidden email]> wrote:
Hi Jeb,

This example should not require any specific settings apart from them listed in the README file.
Could you send more information, so that we can help you?
  • Versions of Sonar, JavaSript plugin, Maven, etc.
  • Log files
  • Can you check if your tests reports have been generated in target/jstestdriver after running "mvn test"?

Thank you

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 13:34, Jebastin Prabaharan <[hidden email]> wrote:
Hi,

   When I execute sonar(using Maven) for JavaScript project provided under https://github.com/SonarSource/sonar-examples, the code coverage and unit tests are shown as zero, even though there are unit tests present. 

Does the JavaScript plugin requires any additional settings in order to use find coverage?

Regards,
-Jeb




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unit Tests and Code Coverage for Sonar JavaScript Plugin

David Racodon-2
Good news!

Indeed, it would make things easier if Sonar could handle everything by itself.
But it is not that easy as dozens of unit tests and code coverage frameworks are available.
That's why, we've tried to build a generic process to give the ability to reuse existing reports when possible.

And if you feel to contribute to the JavaScript plugin by enhancing unit tests integration, you're more than welcome.

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 16:30, Jebastin Prabaharan <[hidden email]> wrote:
Thanks David :) 

I have corrected the path and tests are successful. And the test coverage is shown correctly. 

But why sonar does not run the tests unlike Java Projects where the Junits are run internally.

Regards,
-Jeb

On Wed, Jul 4, 2012 at 7:51 PM, David Racodon <[hidden email]> wrote:
Hi Jeb,

OK, so the issue is on jtestdriver side, not Sonar.
On Mac, it seems that the path to Chrome would be more like /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.
I'll let you give a try and then dig into the jtestdriver documentation if it does not solve your issue.

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 15:48, Jebastin Prabaharan <[hidden email]> wrote:
Hi David,

   Please find the versions below,

Versions
  • Sonar - 3.1.1
  • JavaScript Plugin - 1.0
  • Maven - 3.0.3
I have attached the log files.

I ran "mvn sonar:sonar" and the test files are not found under the reports. I was under impression that "mvn sonar:sonar internally runs the unit test. 

When I try to run the "mvn test" after changing the browser path in the pom to "/Applications/Google Chrome.app" the tests are failing with the following exception stack.


Running: java -classpath /Users/jeb/.m2/repository/com/googlecode/jstd-maven-plugin/jstd-maven-plugin/1.3.2.5/jstd-maven-plugin-1.3.2.5.jar;/Users/jeb/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar;/Users/jeb/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar;/Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.0-beta-3.0.1/plexus-component-annotations-1.0-beta-3.0.1.jar;/Users/jeb/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar;/Users/jeb/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar;/Users/jeb/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar;/Users/jeb/.m2/repository/com/google/code/google-collections/google-collect/snapshot-20080530/google-collect-snapshot-20080530.jar;/Users/jeb/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar;/Users/jeb/.m2/repository/org/apache/maven/artifact/maven-artifact/3.0-alpha-1/maven-artifact-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.jar;/Users/jeb/.m2/repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar;/Users/jeb/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar;/Users/jeb/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.6/wstx-asl-3.2.6.jar;/Users/jeb/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar;/Users/jeb/.m2/repository/org/sonatype/spice/model-builder/1.0/model-builder-1.0.jar;/Users/jeb/.m2/repository/org/apache/maven/maven-project-builder/3.0-alpha-1/maven-project-builder-3.0-alpha-1.jar;/Users/jeb/.m2/repository/org/jvnet/wagon-svn/wagon-svn/1.8/wagon-svn-1.8.jar;/Users/jeb/.m2/repository/org/jvnet/hudson/svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar;/Users/jeb/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar -jar /Users/jeb/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar --basePath /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver --browser /Applications/Google Chrome.app --captureConsole --config /Users/jeb/work/projects/phresco-projects/sonar-examples/projects/languages/javascript/javascript-maven-JsTestDriver/src/test/resources/jsTestDriver.conf --port 9876 --testOutput target/jstestdriver --tests all --verbose
Failures during test run.
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:62)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at com.google.jstestdriver.browser.CommandLineBrowserRunner.stopBrowser(CommandLineBrowserRunner.java:56)
at com.google.jstestdriver.browser.BrowserControl.stopBrowser(BrowserControl.java:79)
at com.google.jstestdriver.browser.BrowserCallable.call(BrowserCallable.java:30)
at com.google.jstestdriver.util.RetryingCallable.call(RetryingCallable.java:49)
... 10 more

at com.google.jstestdriver.browser.BrowserActionExecutorAction.run(BrowserActionExecutorAction.java:142)
at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:64)
at com.google.jstestdriver.JsTestDriver.main(JsTestDriver.java:86)
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.NullPointerException
Failure 2: java.lang.NullPointerException
Failure 3: java.lang.NullPointerException
Unexpected Runner Condition: Failures during test run.
 Use --runnerMode DEBUG for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.886s
[INFO] Finished at: Wed Jul 04 19:14:55 GMT+05:30 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.googlecode.jstd-maven-plugin:jstd-maven-plugin:1.3.2.5:test (run-tests) on project javascript-maven-JsTestDriver: Failed to parse results -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
Jebastins-MacBook-Pro:javascript-maven-JsTestDriver jeb$ mvn test


Regards,
-Jeb

On Wed, Jul 4, 2012 at 6:29 PM, David Racodon <[hidden email]> wrote:
Hi Jeb,

This example should not require any specific settings apart from them listed in the README file.
Could you send more information, so that we can help you?
  • Versions of Sonar, JavaSript plugin, Maven, etc.
  • Log files
  • Can you check if your tests reports have been generated in target/jstestdriver after running "mvn test"?

Thank you

Regards,

David RACODON | SonarSource
Senior Consultant



On 4 July 2012 13:34, Jebastin Prabaharan <[hidden email]> wrote:
Hi,

   When I execute sonar(using Maven) for JavaScript project provided under https://github.com/SonarSource/sonar-examples, the code coverage and unit tests are shown as zero, even though there are unit tests present. 

Does the JavaScript plugin requires any additional settings in order to use find coverage?

Regards,
-Jeb




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Loading...