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

Issue with text() nodes in coverage report in 3_0_3 #1920

Open
birdya22 opened this issue Apr 29, 2024 · 3 comments
Open

Issue with text() nodes in coverage report in 3_0_3 #1920

birdya22 opened this issue Apr 29, 2024 · 3 comments

Comments

@birdya22
Copy link

I've attached a test case where xspec reports missed code for some text() nodes.

I've commented the stylesheet with details of the results I see and what I expect. The basic problem is that if the parent element of a text() node includes any attributes then xspec reports a miss on that text() node. It doesn't matter what the parent is and I've provided examples of xsl:text, xsl:when, xsl:otherwise, xsl:comment and a user node.
The issue isn't in xspec but in Saxon where Amanda has logged a problem, https://saxonica.plan.io/issues/6405, and I've added a comment.
The problem occurs when using the Saxon tiny tree, which is the default.

If you use the linked tree then the coverage results are as expected (to do this I added treeModel="linkedTree" into my copy of your coverage-report-config.xml - I would have used SAXON_CUSTOM_OPTIONS, but as the Wiki says this has no effect when formatting the test result).

The last test with the xsl:variable shows something different happening in that the parent of the text() node has an attribute but the text() is shown as a hit. I believe this is different because of lines 363-363 in coverage-reporter.xsl, but do you actually need those lines as Saxon does trace non-global xsl:variable hits in 12.4.
Similarly, when looking at the code, do you need xsl:for-each on line 337 as Saxon traces that as well (don't know about xsl:for-each-group).

Disregard the test results as I didn't bother trying to get those correct.

NOTE: I need to raise an issue with Saxonica about setting the tree model because I believe it always uses the tiny tree for the source document but will use the specified tree for any other documents e.g. from doc() or unparsed-text() and so it works when doing the coverage report.

Finally, would it be possible to change the css for the coverage report to use the same green and pink colours used in the test report so they are consistent? (Would you like another issue raised for this?)

Adrian
TextCoverageTest.zip

@birdya22
Copy link
Author

I went back to testing my code and found I should not have talked about the xsl:variable and xsl:for-each bits of code above without doing some checking.
My code has a number of global variables which contain xsl:for-each elements and some of these are shown as hits even though they are not used. I'm also seeing different results depending on what test I run. I'm going to have to raise another issue I'm afraid.
Adrian

@galtm
Copy link
Collaborator

galtm commented Apr 29, 2024

I went back to testing my code and found I should not have talked about the xsl:variable and xsl:for-each bits of code above without doing some checking. My code has a number of global variables which contain xsl:for-each elements and some of these are shown as hits even though they are not used. I'm also seeing different results depending on what test I run. I'm going to have to raise another issue I'm afraid. Adrian

OK, I see that you created #1921.

@galtm
Copy link
Collaborator

galtm commented Apr 29, 2024

Finally, would it be possible to change the css for the coverage report to use the same green and pink colours used in the test report so they are consistent? (Would you like another issue raised for this?)

There have been some discussions about improving the test report, but the discussions haven't been conclusive. If you raise an issue about the coverage report (which you are welcome to do), it would be really useful if you wrote what your underlying objectives or requirements are -- such as consistency with the test report, which you mentioned here. If the test report changed its look and feel, perhaps you'd like the coverage report to be similar. I've also been thinking about accessibility, because green and pink might be hard for people with red/green color blindness to distinguish.

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

No branches or pull requests

2 participants