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

feat(xslt): coverage reporter for SonarQube #1005

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

VTristan
Copy link

@VTristan VTristan commented Jun 18, 2020

Proposal for issue #877
I propose to answer this issue by adding a new stylesheet coverage-sonar-report.xsl and by factoring coverage-report.xsl.

The new report generated, corresponds to the generic format of SonarQube.

Just change the environment variables.
e.g on windows:
set "COVERAGE_REPORTER_XSL=%XSPEC_HOME%\src\reporter\coverage-sonar-report.xsl"
set "COVERAGE_HTML=%TEST_DIR%\%TARGET_FILE_NAME%-sonar-coverage.xml"

(I did a second fork, to offer a cleaner and more up-to-date PR).

@AirQuick AirQuick added this to the v2.0 milestone Jun 19, 2020
@AirQuick AirQuick linked an issue Jun 19, 2020 that may be closed by this pull request
@AirQuick AirQuick changed the title issues:877 sonarQube compatible coverage reporter feat(xslt): coverage reporter for SonarQube Jun 19, 2020
@AirQuick
Copy link
Member

Thanks for restarting the pr, @VTristan
Unfortunately some problems still persist:

  • Every line in coverage-report.xsl is considered modified, due to line ending characters. See the diff.

  • If you run bin\xspec.bat -c tutorial\coverage\demo.xspec (without setting COVERAGE_REPORTER_XSL and COVERAGE_HTML), the imported module name in demo-coverage.html is wrong:

    module: .../tutorial/coverage/demo.xsl; 25 lines

    It should be

    module: .../tutorial/coverage/demo-imported.xsl; 25 lines

<xsl:variable name="context" as="node()*" select="trace/m"/>

<coverage version="1">
<xsl:for-each select="$context[not(contains(@u,'xspec-utils.xsl'))]">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that #1014 is merged into the master, I think you can remove the predicate.

Suggested change
<xsl:for-each select="$context[not(contains(@u,'xspec-utils.xsl'))]">
<xsl:for-each select="$context">

@AirQuick
Copy link
Member

If you merge the latest master into this branch and run

set COVERAGE_REPORTER_XSL=
set COVERAGE_HTML=
bin\xspec.bat -c test\end-to-end\cases\coverage-no-hit.xspec

then the generated coverage-no-hit-coverage.html looks like this. From there, you can understand that two stylesheets (coverage-no-hit.xsl and coverage-no-hit_included.xsl) are involved but not tested.

On the other hand, if you run

set COVERAGE_REPORTER_XSL=src\reporter\coverage-sonar-report.xsl
set COVERAGE_HTML=coverage-sonarqube.xml
bin\xspec.bat -c test\end-to-end\cases\coverage-no-hit.xspec

then the generated coverage-sonarqube.xml is

<coverage version="1"></coverage>

where you can't identify the two involved-but-untested stylesheets. Is that fine?

@AirQuick AirQuick removed this from the v2.0 milestone Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Xsl coverage report for the sonarQube platform
2 participants