We have recently upgraded sonar from 2.14 to sonar 4.2. This has an effect on the Unit Test coverage values. The Unit Test showed 100% with 0 errors but after the upgrade it now coming as 93.6% and 243 errors. If I see the details of the error, it shows the error message "A NullPointerException was thrown. This may indicate an error in your ActionForm, or it may indicate that the Struts ActionServlet was unable to find struts config file. TestCase is running from C:\Java\Jenkins\jobs\abc-quality\workspace\abc-WEB directory. Context directory is C:\Java\Jenkins\jobs\abc-quality\workspace\abc-WEB\WebContent. struts config file must be found under the context directory, the directory the test case is running from, or in the classpath.
servletunit.struts.ExceptionDuringTestError: A NullPointerException was thrown. This may indicate an error in your ActionForm, or it may indicate that the Struts ActionServlet was unable to find struts config file. TestCase is running from C:\Java\Jenkins\jobs\abc-quality\workspace\abc-WEB directory. Context directory is C:\Java\Jenkins\jobs\abc-quality\workspace\abc-WEB\WebContent. struts config file must be found under the context directory, the directory the test case is running from, or in the classpath."
We have not changed any configuration post upgrade so don't understand the reason of this error. This has further affected the code coverage percentage on sonar dashboard. How to resolve this error and get the unit test percentage as 100%. Also, I would like to add that I see the same issue when we upgrade to sonar 3.4.1 from 2.14. Any workaround for it?
We are using cobertura and not jacoco so would need help with cobertura end.
sonar properties being used are as below:
-Dsonar.login=sonar
-Dsonar.password=sonar
-Dsonar.dynamicAnalysis=reuseReports
-Dsonar.java.coveragePlugin=cobertura
-Dsonar.cobertura.reportPath=target/site/cobertura/coverage.xml
Related
So I've managed to get jasmine maven plugin to work with maven and our js unit test.
All is running well, but i found when there's a test that failed, bamboo will say it failed, but the error is "No failed tests found, possible compilation error ocurred".
I've tried to get it to parse TEST-jasmine.xml result by specifically specify the folder JUnit parser needed, and get jasmine to write to that folder using jasmineTargetDir tag in pom.xml, but it's still not finding the right result. Jasmine faithfully write the test result to the folder, but seemingly JUnit is not parsing it?
Any clue as to why and how to solve the issue?
Running on Bamboo v 5.14.3.1 I've configured the Maven task of Default Stage to search for test result files:
And then produced fake failing test. After that the build failed with failing test:
Hope this helps
I have used Maven project with Selenium & TestNG to create automated scripts which I want to execute from Jenkins. In Jenkins I have added the TestNG plugin to publish the TestNG report. But it is not getting displayed. I'm getting the below mentioned error.
Error:
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: /target/surefire-reports/testng-results.xml
Did not find any matching files.
Finished: SUCCESS
Actual path of the TestNG report file:
E:\STUDY_MATERIAL\JAVA\WORKSPACE\SeleneniumFrameWork\target\surefire-reports\testng-results.xml
I have tried the following options but didn't work out for me.
Tried giving the full path of the TestNG report. Forward ans backward slash in the pattern.
I have tried different other options by changing the TestNG result file path but it's working for me.
Please share some inputs on how to resolve this issue.
"testng-results.xml" file is available in workspace. But it's failed to display the report. I have attached screenshot of Jenkins workspace and Console Output.
Note: I am using Jenkins 2.7.0 in Windows 10.
Jenkins Workspace
I have attached the Job configuration details of Jenkins.
Job Configuration Details
Few checkpoints :
1. Check if testng is producing this file at the specified location : /target/surefire-reports/testng-results.xml
2. TestNG needs to be configured to generate xml report
If this file is there, pass path in file locator as :
target/surefire-reports/testng-results.xml
Hopefully, you will get results on jenkins if everything mentioned above is correct.
I'm running sonar-runner inside my project folder
I have put and configured the sonar-runner.properties in my project as well. But still the execution Sonar failed. Any idea as to what could be the problem ?
If project configuration file(sonar-project-properties) is being ignored then what is the workaround. Pl suggest asap.
This error is telling you that the Scanner is not finding your project properties. That is likely because the default name of the file is not sonar-runner.properties, nor sonar-project-properties, but sonar-project.properties.
I am working on to get Functional Test Coverage using JaCoCo and SONAR for a java based application.
My Requirement:
Get Functional Test Coverage.
Publish the Functional Test Coverage results to SONAR(pass on the jacoco.exec file to SONAR)
Below is the set up I did:
Set up instances on my DVL(development box) and make the system up and running.
In the /bin directory of the instances, I am including jacoco agent in the CATALINA_OPTS variable with below configuration:
vim catalina.sh
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:${XYZ_ROOT}/WEB-INF/lib/org.jacoco.agent-0.5.8.201206210517.jar=includes=com.xyz.xx.*,excludes=com.xyz.xx.webclient.command.UIBean,output=tcpclient,address=lxdm379m7.xyz.com,port=9000"
(lxdm379m7.xyz.com is my sonar server and 9000 is the port number)
Now restarted the server, And the server is up.
I do manual testing on my AUT which is on my DVL. Hit pages back and forth.
My Issue:
Not able to generate the jacoco.exec file.
Help I need:
Why is the jacoco.exec file not generated.
If it is generated, where can I find it? and how to pass it on to SONAR ?
Any help or clue on this is appreciated.
Maybe, this question is silly but I'm very new. I try to search without luck.
I got two errors when building maven project with sonar:
No information about coverage per test.
Although I had test code and these testing classes cover the code.
The global property 'sonar.doxygen.deploymentPath' is not set. Set it in SONAR and run another analysis.
I dont know it should be set where in sonar server. I set in web.xml or sonar-server.properties but it does not work.
Thanks.
About the first warning message this is not an error but a warning : since Sonar 3.5 this is possible to get the code coverage relating to each unit test. Here the message just says that this feature is not activated which is expected by default. Nevertheless I do agree that this warning message can be misleading.
About the second error message, I don't know the doxygen plugin but the message seems to be pretty clear : the sonar.doxygen.deploymentPath property has not be defined. See the plugin documentation : http://docs.codehaus.org/display/SONAR/Doxygen+Plugin.
Two things:
There is no war folder anymore since the sonarqube has given up tomcat support
The doxygen plugin is not implemented to upload the files in to the sonarqube server &/ installation, which means it only can be done by referencing the path inside your installation, e.g.:
run "mvn install sonar:sonar" in your project "/root/test.example.sonar.com"
in sonarqube set the cfg-key "sonar.doxygen.deploymentPath" the value: "/root/sonarqube-4.1.1/web/" and the cfg-key "sonar.doxygen.deploymentUrl" the value: "http://:9000"
have fun with your doxygen
Remember that the plugin will only be run through your mvn cmd, refreshing the page only will not do the job, you will have to analyse again after each cfg set :/
Check the file system and folder permission