简体   繁体   中英

How can I covert a Jenkins log file artifact into a xml file to Publish Junit report?

Hi I am trying to get a JUnit report but currently, it fails because of error in reading the xml file:

url=http://jenkins-ci:8080/job/test-job/lastSuccessfulBuild
wget -q -O- $url/api/xml?tree=artifacts[relativePath] | xpath '//relativePath/text()' 2>&1 | sed -re 's/-- NODE --//g' | tail -n+3\
| while read fileName;\
do \
   wget "${url}/artifact/${fileName}";\

done
mv unit-test.log unit-test.xml
touch *.xml

This is what I see when I try to visulaize this with analyzer plugin:

unit-test.xml : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed.

Would love if somebody can propose a solution in groovy

I was able to solve my need for JUnit report history/visualization via the JUnit Plugin .

The configuration is very simple and straight-forward:

Specify the path to JUnit XML files in the Ant glob syntax, such as **/build/test-reports/*.xml. Be sure not to include any non-report files into this pattern. You can specify multiple patterns of files separated by commas. The base directory of the fileset is the workspace root.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM