JUnit Results not parsing in Jenkinsfile-based Pipeline Build

413 views
Skip to first unread message

Matt Hollingsworth

unread,
Aug 18, 2019, 8:58:24 AM8/18/19
to Jenkins Users
Hi everyone,

I ran into a weird issue that I thought you might be able to help troubleshoot. I'm using Jenkinsfile-based Pipelines with python, and I use pytest to produce JUnit-compatible reports after the tests are run. The problem is that I get an error when I try to parse the results with the junit step: "No test report files were found. Configuration error?" Here are the relevant parts of the Jenkinsfile:

stage("Unit tests") {
  steps {
    sh "runtests.sh" // This produces build/pytest.xml
    sh "cat build/pytest.xml"
    junit 'build/pytest.xml'
  }
}

The sh’s cat command runs properly and prints out a properly formatted junit xml file--I can parse it with junit-viewer, for example. But I still get the error. Any idea what's going on, or how I could debug this properly?

Thanks for the help!

Best,
Matt

Ullrich Hafner

unread,
Aug 18, 2019, 4:52:20 PM8/18/19
to Jenkins Users
Shoudn’t the command use ’testResults’ as parameter name?

junit testResults: '**/build/pytest.xml'


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8e1eae66-4c8b-4de0-9d9e-e0474a7ab93c%40googlegroups.com.

Matt Hollingsworth

unread,
Aug 20, 2019, 8:25:08 PM8/20/19
to Jenkins Users
Hi Ullrich,

Thanks for the suggestion! I tried that, and still saw the problem. Speficially, I did this:

stage (“Unit tests”) {
  sh “runtests.sh”
  sh “cat build/pytest.xml”
  junit testResults: “**/build/pytest.xml"
}

Are there instructions anywhere for how to setup a dev environment for plugins? I’m happy to debug this myself, I’m just not sure exactly where to start.


Best,
Matt
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/Rw49YOnH-nk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/D0E7E558-57F6-4B92-8724-3D7156A5EA96%40gmail.com.

Jan Monterrubio

unread,
Aug 21, 2019, 9:51:42 AM8/21/19
to jenkins...@googlegroups.com
I’ve found success debugging through the plug-ins by using a combination of:

- the Jenkins Test harness 
- the plugin as a dependency
- using the Jenkins rule to run a job and hit the plugins breakpoint. 

Here’s some resources that might help:

I’d start with a fresh gradle project and add the jpi and test harness and get that working and then adding the dependencies. 

The jpi plugin should let you use plugins as dependencies (and your ide might be able to download the sources for you to debug. 

Matt Hollingsworth

unread,
Aug 22, 2019, 2:37:13 PM8/22/19
to jenkins...@googlegroups.com
Thanks Jan! I’ll try it out and see what I find.

Best,
Matt
Reply all
Reply to author
Forward
0 new messages