What is the TestNG XML report pattern for Jenkins

2019-08-19 14:53发布

问题:

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?

回答1:

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!!!



回答2:

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.