将opencover xml输出转换为ncover xml(transform opencover xml output to ncover xml)

编程入门 行业动态 更新时间:2024-10-27 10:31:33
将opencover xml输出转换为ncover xml(transform opencover xml output to ncover xml)

我需要能够将开放式覆盖结果导入Jenkins以随时间推移覆盖趋势数据。 看来,最好的方法是找到一种方法将opencover xml格式转换为ncover格式,然后使用NCover插件导入结果。 是否存在将opencover转换为ncover的现有xslt,或者将进行转换的开源工具? 我搜索过,我一无所获。

谢谢

I need the ability to import opencover coverage results in to Jenkins to pull coverage trending data over time. It appears that the best way to do this is going to be finding a way to convert the opencover xml format to ncover format, and then use the NCover plugin to import the results. Is there an existing xslt that will transform opencover to ncover, or an open source tool that will do the conversion? I've searched, and I'm finding nothing.

thanks

最满意答案

OpenCover wiki上提供了以下XSLT,可以帮助您入门。

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" standalone="yes"/> <xsl:template match="/CoverageSession/Modules"> <coverage> <xsl:for-each select="Module[not(@skippedDueTo)]"> <module name="{ModuleName}"> <xsl:for-each select="Classes/Class"> <xsl:if test="count(Methods/Method) &gt; 0"> <class name="{FullName}"> <xsl:variable name="className" select="FullName" /> <xsl:for-each select="Methods/Method"> <method class="{$className}"> <xsl:for-each select="SequencePoints/SequencePoint"> <seqpnt visitcount="{@vc}" /> </xsl:for-each> </method> </xsl:for-each> </class> </xsl:if> </xsl:for-each> </module> </xsl:for-each> </coverage> </xsl:template> </xsl:stylesheet>

The following XSLT is available on the OpenCover wiki which might get you started.

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" indent="yes" standalone="yes"/> <xsl:template match="/CoverageSession/Modules"> <coverage> <xsl:for-each select="Module[not(@skippedDueTo)]"> <module name="{ModuleName}"> <xsl:for-each select="Classes/Class"> <xsl:if test="count(Methods/Method) &gt; 0"> <class name="{FullName}"> <xsl:variable name="className" select="FullName" /> <xsl:for-each select="Methods/Method"> <method class="{$className}"> <xsl:for-each select="SequencePoints/SequencePoint"> <seqpnt visitcount="{@vc}" /> </xsl:for-each> </method> </xsl:for-each> </class> </xsl:if> </xsl:for-each> </module> </xsl:for-each> </coverage> </xsl:template> </xsl:stylesheet>

更多推荐

本文发布于:2023-08-02 20:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1379960.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   xml   opencover   output   transform

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!