Details
-
Type:
New Feature
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: JTest
-
Labels:None
-
Environment:Sonar : Linux
Sonar DB : MySql
Eclipse/jtest : Windows
-
Testcase included:yes
-
Number of attachments :4
Description
I am currently running on sonar 1.7 and we are using the Parasoft Jtest for code coverage and unit tests.
The total code coverage result seems to be incorrect.
When I generate a aggregate jtest report with one of our projects it shows a total of 100% code coverage
Sonar however shows a total code coverage of 0.0%
I use a project without modules.
Plese somone know what's the problem ?
-
- Sans titre.bmp
- 17/Apr/09 11:05 AM
- 250 kB
- Makram Manai
-
- Sans titre2.bmp
- 17/Apr/09 11:05 AM
- 26 kB
- Makram Manai
-
Hide
- sonar-jtest-plugin-1.0.jar
- 12/Jul/12 6:14 PM
- 9 kB
- Carlos Ramirez
-
- META-INF/MANIFEST.MF 0.6 kB
- com/smartmatic/.../jtest/JTestSensor.class 3 kB
- com/smartmatic/.../JTestXmlProcessor.class 7 kB
- com/smartmatic/.../jtest/JTestProfile.class 3 kB
- com/smartmatic/.../JTestRuleRepository.class 2 kB
- com/smartmatic/.../jtest/JTestPlugin.class 2 kB
-
Hide
- sonar-jtest-plugin-1.0-src.zip
- 12/Jul/12 6:14 PM
- 270 kB
- Carlos Ramirez
-
- src/META-INF/manifest.mf 0.5 kB
- src/com/.../jtest/JTestRuleRepository.java 1 kB
- src/com/.../jtest/JTestSensor.java 2 kB
- src/com/.../jtest/JTestXmlProcessor.java 6 kB
- src/com/.../jtest/JTestPlugin.java 2 kB
- src/com/.../jtest/JTestProfile.java 2 kB
- src/report.xml 3.50 MB
Activity
Makram, I need your help and your answer to my last comment in order to try fixing this ticket.
Thanks
Freddy
Freddy Mallet, sorry but I expected the license Jtestcli to run Jtest's tests .
by typing: $mvn org.codehaus.sonar: sonar-maven-plugin: 1.7: sonar
with the correct pom's ant plugin : (pom.xml)
...
<!-- Run Jtest tests during the test phase -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<configuration>
<tasks>
<mkdir dir="$
<property name="maven.test.classpath" refid="maven.test.classpath"/>
<exec
dir="${basedir}
"
executable="/opt/data/parasoft-jtest-8.2/jtestcli"
failonerror="true">
<arg line="-J-Xmx1024m -source 'src/main/java' -temp_project 'TestExerciceQT2' -force -classpath '$
</exec>
<exec
dir="${basedir}"
executable="/opt/data/parasoft-jtest-8.2/jtestcli"
failonerror="true">
<arg line="-J-Xmx1024m -source 'src/test/java' -temp_project 'TestExerciceQT2' -force -classpath '${maven.test.classpath}
' -config 'Run Unit Tests' -report '$
{basedir}/target/site/jtest/UnitTestReport'" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
...
I get the following result:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building ExerciceQT2
[INFO] task-segment: [org.codehaus.sonar:sonar-maven-plugin:1.7:sonar] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar:sonar]
[INFO] ------------------------------------------------------------------------
[INFO] Building ExerciceQT2
[INFO] task-segment: [org.codehaus.sonar:sonar-core-maven-plugin:1.7:dependencies]
[INFO] ------------------------------------------------------------------------
[INFO] [sonar-core:dependencies]
[INFO] ------------------------------------------------------------------------
[INFO] Building ExerciceQT2
[INFO] task-segment: [org.codehaus.sonar:sonar-core-maven-plugin:1.7:prepare]
.
.
.
[INFO] ------------------------------------------------------------------------
[INFO] Building ExerciceQT2
[INFO] task-segment: [org.codehaus.mojo:cobertura-maven-plugin::cobertura]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing cobertura:cobertura
[INFO] [cobertura:instrument]
[INFO] Not executing cobertura:instrument as the project is not a Java classpath-capable package
[INFO] [antrun:run
]
[INFO] Executing tasks
[exec] jtestcli: Version 8.2.62 – Copyright (C) 2003-2008 Parasoft Corporation
[exec] jtestcli: Using default workspace "/opt/data/apache-tomcat/.jtest_linux/workspace"
[exec] > [0%] Running: Scope
[exec] > [4%] Computing scope
[exec] >> [4%] Initializing
[exec] >> [8%] Updating
[exec] >> [14%] Refreshing
[exec] >> [14%] Opening TestExerciceQT2.
[exec] >> [14%] Refreshing
[exec] >> [15%] TestExerciceQT2
[exec] >> [15%] Refreshing
[exec] >> [15%] Refreshing /TestExerciceQT2.
[exec] >> [20%] Refreshing
[exec] >> [20%] Building
[exec] >> [21%] TestExerciceQT2
[exec] >> [21%] Building
[exec] >> [21%] Invoking Java Builder on /TestExerciceQT2.
[exec] >> [21%] Preparing to build TestExerciceQT2
[exec] >> [21%] Cleaning output folder for TestExerciceQT2
[exec] >> [21%] Copying resources to the output folder
[exec] >> [21%] Analyzing sources
[exec] >> [22%] Compiling TestExerciceQT2/java/fr/ca/sa/com/../src/test4
[exec] >> [27%] Build done
[exec] >> [27%] Building
[exec] >> [27%] Finding files
[exec] >> [29%] TestExerciceQT2
[exec] >> [31%] Finding files
[exec] >> [33%] Applying filters
[exec] >> [33%] CompteBO.java
[exec] >> [33%] LigneDeCompteBO.java
[exec] >> [33%] AssociationLigneCompte.java
[exec] >> [33%] TypeCompte.java
[exec] >> [33%] TypeLigneCompte.java
[exec] >> [33%] PersonneBO.java
[exec] >> [36%] Applying filters
[exec] >> [36%] Computing lines to check
[exec] >> [46%] Reporting scope results
[exec] >> [46%] TestExerciceQT2
[exec] >> [49%] Reporting scope results
[exec] Total Files: 6
[exec] Files to Check: 6
[exec] Total Lines: 484
[exec] Lines to Check: 484
[exec] Excluded Files: 0
[exec] > [49%] Running: Execution
[exec] >> [61%] Precomputing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing tests
[exec] >> [63%] Adding extra files
[exec] >> [63%] Computing tested types
[exec] >> [63%] Finding types
[exec] >> [63%] Computing tested members
[exec] >> [63%] Computing unit tests
[exec] > [63%] Execution: launching tests
[exec] Executed Test Cases: 0
[exec] Runtime Exceptions: 0
[exec] Assertion Failures: 0
[exec] Contract Violations: 0
[exec] Profiling Problems: 0
[exec] Unverified Outcomes: 0
[exec] Coverage:
[exec] Line: –
[exec] > [100%] Done
[exec] > Deleting temporary project TestExerciceQT2...
[exec] ok
[exec] jtestcli: Version 8.2.62 – Copyright (C) 2003-2008 Parasoft Corporation
[exec] jtestcli: Using default workspace "/opt/data/apache-tomcat/.jtest_linux/workspace"
[exec] > [0%] Running: Scope
[exec] > [4%] Computing scope
[exec] >> [4%] Initializing
[exec] >> [8%] Updating
[exec] >> [14%] Refreshing
[exec] >> [14%] Opening TestExerciceQT2.
[exec] >> [14%] Refreshing
[exec] >> [15%] TestExerciceQT2
[exec] >> [15%] Refreshing
[exec] >> [15%] Refreshing /TestExerciceQT2.
[exec] >> [20%] Refreshing
[exec] >> [20%] Building
[exec] >> [21%] TestExerciceQT2
[exec] >> [21%] Building
[exec] >> [21%] Invoking Java Builder on /TestExerciceQT2.
[exec] >> [21%] Preparing to build TestExerciceQT2
[exec] >> [21%] Cleaning output folder for TestExerciceQT2
[exec] >> [21%] Copying resources to the output folder
[exec] >> [21%] Analyzing sources
[exec] >> [27%] Build done
[exec] >> [27%] Building
[exec] >> [27%] Finding files
[exec] >> [29%] TestExerciceQT2
[exec] >> [31%] Finding files
[exec] >> [33%] Applying filters
[exec] >> [36%] Computing lines to check
[exec] >> [46%] Reporting scope results
[exec] Total Files: 0
[exec] Files to Check: 0
[exec] Total Lines: –
[exec] Lines to Check: –
[exec] Excluded Files: 0
[exec] > [49%] Running: Execution
[exec] >> [61%] Precomputing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing tests
[exec] >> [63%] Adding extra files
[exec] >> [63%] Computing tested types
[exec] >> [63%] Finding types
[exec] >> [63%] Computing tested members
[exec] >> [63%] Computing unit tests
[exec] Executed Test Cases: 0
[exec] Runtime Exceptions: 0
[exec] Assertion Failures: 0
[exec] Contract Violations: 0
[exec] Profiling Problems: 0
[exec] Unverified Outcomes: 0
[exec] Coverage:
[exec] Line: –
[exec] > [100%] Done
[exec] > Deleting temporary project TestExerciceQT2...
[exec] ok
[INFO] Executed tasks
[INFO] [cobertura:cobertura]
[INFO] Not executing cobertura:report as the cobertura data file (/opt/data/apache-continuum_data/working-directory/81/target/cobertura/cobertura.ser) could not be found
[INFO] ------------------------------------------------------------------------
[INFO] Building ExerciceQT2
[INFO] task-segment: [org.codehaus.sonar:sonar-core-maven-plugin:1.7:collect]
[INFO] ------------------------------------------------------------------------
[INFO] [sonar-core:collect]
[INFO] org.sonar.maven.ProfileProvider Selected quality profile : D2I_Fr, language=java
[INFO] Starting class org.sonar.plugins.pmd.cpd.CpdMavenCollector
[INFO] Starting class org.sonar.plugins.pmd.PmdMavenCollector
[INFO] Starting class org.sonar.plugins.javancss.JavaNcssMavenCollector
[INFO] Starting class org.sonar.plugins.core.SaveProfileMavenCollector
[INFO] Starting class org.sonar.plugins.core.sources.ImportSourcesMavenCollector
[INFO] Starting class org.sonar.plugins.checkstyle.CheckstyleMavenCollector
[INFO] Starting class org.sonar.plugins.cobertura.CoberturaMavenCollector
[INFO] Starting class org.sonar.plugins.surefire.SurefireMavenCollector
[INFO] o.s.p.s.SurefireMavenCollector parsing /opt/data/apache-continuum_data/working-directory/81/target/surefire-reports
[INFO] ------------------------------------------------------------------------
[INFO] Building ExerciceQT2
[INFO] task-segment: [org.codehaus.sonar:sonar-core-maven-plugin:1.7:batch] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar-core:batch]
[INFO] ------------------------------------------------------------------------
[INFO] Building ExerciceQT2
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory /opt/data/apache-continuum_data/working-directory/81/target
Downloading: http://55.2.158.95:8080/archiva/repository/internal//parasoft/com/jtest/8.2/jtest-8.2.pom
Downloading: http://55.2.158.95:8080/archiva/repository/public//parasoft/com/jtest/8.2/jtest-8.2.pom
Downloading: http://repo1.maven.org/maven2/parasoft/com/jtest/8.2/jtest-8.2.pom
[INFO] [antrun:run
]
[INFO] Executing tasks
[mkdir] Created dir: /opt/data/apache-continuum_data/working-directory/81/target/site/jtest
[exec] jtestcli: Version 8.2.62 – Copyright (C) 2003-2008 Parasoft Corporation
[exec] jtestcli: Using default workspace "/opt/data/apache-tomcat/.jtest_linux/workspace"
[exec] > [0%] Running: Scope
[exec] > [4%] Computing scope
[exec] >> [4%] Initializing
[exec] >> [8%] Updating
[exec] >> [14%] Refreshing
[exec] >> [14%] Opening TestExerciceQT2.
[exec] >> [14%] Refreshing
[exec] >> [15%] TestExerciceQT2
[exec] >> [15%] Refreshing
[exec] >> [15%] Refreshing /TestExerciceQT2.
[exec] >> [20%] Refreshing
[exec] >> [20%] Building
[exec] >> [21%] TestExerciceQT2
[exec] >> [21%] Building
[exec] >> [21%] Invoking Java Builder on /TestExerciceQT2.
[exec] >> [21%] Preparing to build TestExerciceQT2
[exec] >> [21%] Cleaning output folder for TestExerciceQT2
[exec] >> [21%] Copying resources to the output folder
[exec] >> [21%] Analyzing sources
[exec] >> [22%] Compiling TestExerciceQT2/java/fr/ca/sa/com/../src/test4
[exec] >> [27%] Build done
[exec] >> [27%] Building
[exec] >> [27%] Finding files
[exec] >> [29%] TestExerciceQT2
[exec] >> [31%] Finding files
[exec] >> [33%] Applying filters
[exec] >> [33%] CompteBO.java
[exec] >> [33%] LigneDeCompteBO.java
[exec] >> [33%] AssociationLigneCompte.java
[exec] >> [33%] TypeCompte.java
[exec] >> [33%] TypeLigneCompte.java
[exec] >> [33%] PersonneBO.java
[exec] >> [36%] Applying filters
[exec] >> [36%] Computing lines to check
[exec] >> [46%] Reporting scope results
[exec] >> [46%] TestExerciceQT2
[exec] >> [49%] Reporting scope results
[exec] Total Files: 6
[exec] Files to Check: 6
[exec] Total Lines: 484
[exec] Lines to Check: 484
[exec] Excluded Files: 0
[exec] > [49%] Running: Execution
[exec] >> [61%] Precomputing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing tests
[exec] >> [63%] Adding extra files
[exec] >> [63%] Computing tested types
[exec] >> [63%] Finding types
[exec] >> [63%] Computing tested members
[exec] >> [63%] Computing unit tests
[exec] > [63%] Execution: launching tests
[exec] Executed Test Cases: 0
[exec] Runtime Exceptions: 0
[exec] Assertion Failures: 0
[exec] Contract Violations: 0
[exec] Profiling Problems: 0
[exec] Unverified Outcomes: 0
[exec] Coverage:
[exec] Line: –
[exec] > [100%] Done
[exec] > Deleting temporary project TestExerciceQT2...
[exec] ok
[exec] jtestcli: Version 8.2.62 – Copyright (C) 2003-2008 Parasoft Corporation
[exec] jtestcli: Using default workspace "/opt/data/apache-tomcat/.jtest_linux/workspace"
[exec] > [0%] Running: Scope
[exec] > [4%] Computing scope
[exec] >> [4%] Initializing
[exec] >> [8%] Updating
[exec] >> [14%] Refreshing
[exec] >> [14%] Opening TestExerciceQT2.
[exec] >> [14%] Refreshing
[exec] >> [15%] TestExerciceQT2
[exec] >> [15%] Refreshing
[exec] >> [15%] Refreshing /TestExerciceQT2.
[exec] >> [20%] Refreshing
[exec] >> [20%] Building
[exec] >> [21%] TestExerciceQT2
[exec] >> [21%] Building
[exec] >> [21%] Invoking Java Builder on /TestExerciceQT2.
[exec] >> [21%] Preparing to build TestExerciceQT2
[exec] >> [21%] Cleaning output folder for TestExerciceQT2
[exec] >> [21%] Copying resources to the output folder
[exec] >> [21%] Analyzing sources
[exec] >> [27%] Build done
[exec] >> [27%] Building
[exec] >> [27%] Finding files
[exec] >> [29%] TestExerciceQT2
[exec] >> [31%] Finding files
[exec] >> [33%] Applying filters
[exec] >> [36%] Computing lines to check
[exec] >> [46%] Reporting scope results
[exec] Total Files: 0
[exec] Files to Check: 0
[exec] Total Lines: –
[exec] Lines to Check: –
[exec] Excluded Files: 0
[exec] > [49%] Running: Execution
[exec] >> [61%] Precomputing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing selection
[exec] >> [62%] Finding types
[exec] >> [62%] Computing tests
[exec] >> [63%] Adding extra files
[exec] >> [63%] Computing tested types
[exec] >> [63%] Finding types
[exec] >> [63%] Computing tested members
[exec] >> [63%] Computing unit tests
[exec] Executed Test Cases: 0
[exec] Runtime Exceptions: 0
[exec] Assertion Failures: 0
[exec] Contract Violations: 0
[exec] Profiling Problems: 0
[exec] Unverified Outcomes: 0
[exec] Coverage:
[exec] Line: –
[exec] > [100%] Done
[exec] > Deleting temporary project TestExerciceQT2...
[exec] ok
[INFO] Executed tasks
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing /opt/data/apache-continuum_data/working-directory/81/pom.xml to /opt/data/apache-tomcat/.m2/repository/ProjetFormationQT/Exercice/1.0.0-SNAPSHOT/Exercice-1.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 minutes 57 seconds
[INFO] Finished at: Tue May 19 15:33:09 CEST 2009
[INFO] Final Memory: 17M/254M
[INFO] ------------------------------------------------------------------------
but in the Sonar interface the coverage code is empty (absolutely nothing) ![]()
Hi Makram, Thanks for those precisions. I now better understand your context and the way JTests run (ant tasks attached to the test Maven phase). Nevertheless, the only way to perfectly handle JTest is to write a new Sonar plugin. Indeed, JTest is pretty equivalent to cobertura, clover or emma and seems to have its own report formats. I guess this is not exactly the answer you've expected ![]()
Hi freddy,
I need help to develop a plugin for Jtest sonar.
if you have any documents, can you send me please?
thanks
For sure I can help you Makram. Before beginning, if you want you can use the sonar-forge to host your plugin and share it with the Sonar community : Jira, Subversion, Confluence. Just let me know if you're interested. Regardless of this choice, here are the steps to follow in order to write this JTest Sonar plugin :
- Read the Sonar Hello World tutorial
- Copy/Paste the code of the Emma Sonar plugin to create the structure of your JTest plugin
- Delete the EmmaMavenPluginHandler as JTest is not a a Maven plugin and need to be manually attached to the test Maven phase
- Modify the EmmaXmlProcessor in order to adapt it to JTest coverage report
Once this is done, you should have your first version of the JTest Sonar plugin and we'll be able to make a new iteration in order to further.
Hello,
I want to write such plugin because it is the best option for our project. So please tell me if someone have made some progress in order to follow or if someone have more information.
I will make a plugin that read the jtest report in xml format, and fill sonar like findbugs, to have reviews and assign them. Is it possible? I will begin tomorrow with the information that I have, please send me all that you have related to this topic.
Regards,
Carlos
JTest plug in created.
This plugin reads the report.xml generated in JTest and use it to create the rules and the violations. Also if it is provided create the rules with full description using the JTest own documentation.
The properties are:
sonar.jtest.reportPath
Path absolute to the report.xml generated by jtest.
sonar.jtest.sourceprefix
Project source path from JTest workspace. Usually /projectname/src. Used to extract the file name from JTest report
sonar.jtest.rulesPath
Path absolute to the report.xml generated by jtest to be used to create the rules.
sonar.jtest.rulesDescPath
Content of docs.zip that can obtained from parasoft/jtest/9.0/eclipse/plugins/com.parasoft.xtest.standards.eclipse.core.java_9.0.5.20101229 in a jtest installation
Tell me what do you think
I don't know well Parasoft JTest tool, but is there a Maven plugin similar to Cobertura, Emma or Clover, and are you using it ?
When you launch the "mvn clean install" command, I guess your unit tests are correctly executed ?
Do you have any configuration related to unit tests in your pom.xml file and if it is the case, could you attache this configuration to this ticket ?
Thanks for your answer.