Failed to publish TestNG Report in Jenkins - maven

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.

Related

Build passes but seems JMeter test is not running through Maven CMD command

I am trying to execute my JMeter scripts through Maven. I am using Jmeter 5.3 and I am using below pom.xml.
When I execute it through command prompt mvn verify -Dusers=1 -DrampUp=1 -Dloopcount=1 -Durl=1 -DSmokeDemoTest=1, it shows me the build success message but seems it is not executing my JMeter test script that's why I am not getting JTL report file in target folder. I am attaching command prompt execution screenshot. Could you please suggest and help me out on this issue.
POMXML:
CommandPromptExecution Image:
Your test is running fine, the only problem is that there are 0 samplers executed therefore there are no results.
From your very beautiful screenshot of the pom.xml file it's not very clear how do you define the users property, you should have something like:
<properties>
<users>1</users>
<rampUp>1</rampUp>
<loopcount>1</loopcount>
<url>http://example.com</url>
<suite>foo</suite>
</properties>
in the beginning of your pom.xml file.
Once done the properties will be declared and you will be able to override them via -D command-line argument.
Also make sure to properly reference the properties in JMeter test plan using __P() function
If you will still be experiencing problems check the jmeter.log file(s) under target/jmeter/logs folder for any suspicious entries
More information:
How to create user defined properties in Maven
How to Use the JMeter Maven Plugin

Jacoco Session created Exed shows no Coverage on Sonarqube

I created a Exec via JacocoAgent on my Local machine (For IT-Testing). Now when I try to upload this Exec to sonarqube, it shows no Coverage.
I built an Ant Task which created an html Report and there I saw, that there was definetely coverage generated. I saw it also in the Jacoco Plugin for Eclipse.
Any Suggestions ?
To execute Sonaranalysis I use Gradle with the "sonar.jacoco.reportpaths" property.
The Log says it is able to read the file (I tried it with the exec, which was generated by Unit Tests and it worked)

What is the TestNG XML report pattern for Jenkins when using Maven with surefire?

I'm using TestNG Results Plugin.
I defined TestNG XML report pattern as: **\target\surefire-reports\testng-results.xml
I'm getting this 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.
What should be the correct pattern?
I just fixed this problem!
It's because that the current directory was changed to the default Jenkins workspace, something like '/Users/Shared/Jenkins/Home/workspace/your_project_name' when it ran!!
You will find it yourself if you add shell command 'pwd' before Post-build Actions in the Configuration of your project in Jenkins.
You just need configure your project in General -> Advanced... -> Use custom workspace, and fill in the full path of your project, and it will work!!!
The following pattern works for me: **/target/surefire-reports/*.xml
Also ensure that the default listeners are not disabled in your surefire configuration to ensure that surefire creates the xml reports for ReoprtNG/TestNG. Until I removed the disabling of default listeners I got the same error.

Jasmine maven plugin parsing test result Atlassian Bamboo

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

set configuration properties in sonar

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

Resources