Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add JUnit report #81

Closed
wants to merge 3 commits into from
Closed

add JUnit report #81

wants to merge 3 commits into from

Conversation

cirulls
Copy link

@cirulls cirulls commented Aug 16, 2016

This pull request adds the functionality to generate a JUnit XML report. This is useful when running XSpec tests on Continuous Integration servers like Jenkins that understand JUnit natively. This pull request addresses a functionality requested in #47. Note that this requires Saxon9-EE or Saxon9-PE as the generation of the JUnit report requires Saxon extension functions.

Technical notes

I described here what I added.

The shell script xspec.sh now contains a -j flag that allows to run the shell script with the option of generating a JUnit report. The report is generated via the XSLT junit-report.xsl that takes as input the XSpec XML report and generate a JUnit XML report in the same directory where the reports are kept.

This feature requires Saxon9-EE or Saxon9-PE as it makes use of Saxon extension functions. When executed with another Saxon version (e.g. Saxon9-HE) the script outputs an error message requesting the correct version of Saxon.

I show here below some screenshots when XSpec is executed within Jenkins (I used the default example provided in XSpec, this could be useful for documentation purposes).

In the pull request I include unit tests for the shell script (see xspec.bats) and XSpec tests for the XSLT transforming the report into JUnit (see xspec-junit.xspec).

jenkins_build_configuration
jenkins_build_trend
jenkins_failing_xspec_test

Sandro Cirulli added 2 commits August 14, 2016 20:55
# The first commit's message is:
#2 initial commit

# This is the 2nd commit message:

add saxon9he

# This is the 3rd commit message:

remove cat and saxon

# This is the 4th commit message:

add tests
@tgraham-antenna
Copy link
Member

Thanks for this.

http://saxonica.com/documentation/index.html#!functions/saxon/serialize says that saxon:serialize() is obsolescent and to use fn:serialize(). http://saxonica.com/documentation/index.html#!functions/fn/serialize says that, from Saxon 9.6, fn:serialize is available in all editions.

Can you see if it will work with Saxon HE if you change junit-report.xsl to use serialize() instead of saxon:evaluate()?

- replace saxon:serialize() with fn:serialize and use XSLT 3.0
- output error message for Saxon8 and Saxon8-SA
- update XSpec unit test (unit test requires support for XSLT 3.0 to run as requested in #74)
- update bats unit test
@cirulls
Copy link
Author

cirulls commented Aug 17, 2016

@tgraham-antenna Thanks for suggesting fn:serialize, I didn't know it. In my latest commit I replaced saxon:serialize() with fn:serialize and I confirm it works fine with Saxon9 HE (I tested it with Saxon9 HE 9.7.0.7 and Saxon9 EE 9.6.0.4). However, XSLT 3.0 is needed for generating the JUnit report, I made it explicit in the stylesheet declaration of junit-report.xsl.

These are the changes I made in the reviewed commit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants