詹金斯测试结果解析 [英] Jenkins test result parsing
问题描述
我的詹金斯有很多工作.这些作业会进行测试并以XML生成测试输出.那些XML测试结果看起来-非常标准-像这样:
I've got a Jenkins with a lot of jobs. These jobs do tests and produce test outputs in XML. Those XML test results look - pretty standard - like this:
<testsuites name="testsuitesname">
<testsuite name="testsuitename">
<testcase classname="classname" name="testcasename">
blabla
</testcase>
</testsuite>
</testsuites>
使用构建后操作 发布JUnit测试结果报告(在作业的配置页面上找到)时,构建的那些发布结果的结构(在詹金斯(Jenkins)中将是这样的:
When you use the Post-build action Publish JUnit test result report (found on the configuration page of a job) the structure of those published results of a build (in Jenkins) will be like this:
-
<root>
(标题:程序包) -
<classname>
(标题:课程) -
<testcasename>
(标题:测试名称)
<root>
(headline: package)<classname>
(headline: class)<testcasename>
(headline: test name)
在此层次结构中没有<testsuitesname>
也没有<testsuitename>
,就像在XML文件中一样.
There is no <testsuitesname>
and no <testsuitename>
in this hierarchy like it is in the XML files.
是否可以选择以下任何一种方式
Is there any option to either:
-
将
<testsuitesname>
和<testsuitename>
添加到Jenkins版本的测试结果发布层次结构中的层次结构中:
add the
<testsuitesname>
and<testsuitename>
to the hierarchy in the test result publishing hierarchy of a Jenkins build:
- (
<root>
) -
<testsuitesname>
-
<testsuitename>
-
<classname>
-
<testclassname>
- (
<root>
) <testsuitesname>
<testsuitename>
<classname>
<testclassname>
或
- 以某种方式向
<testcase>
标签添加更多层次结构?
- somehow add more hierarchy to the
<testcase>
tag?
背景:因为我的测试结果很大(数量很多),所以我想为其添加更多的层次结构/结构,而不仅仅是两个级别(如现在),以获取所有这些结果的更多概览.
Background: Because my test results are quite large (big amount) I want to add more hierarchy/structure to it and not just two levels (like it is now) to gain more overview over all of those results.
有人可以帮助我或遇到类似的问题吗?
Can anybody help me or had a similar problem?
最佳
安迪
推荐答案
不幸的是,我发现改变詹金斯在构造不同测试结构时的行为没有简单的答案.但是,我发现自己想分享的情况有所改善.
Unfortunately I found no easy answer to change the behaviour of Jenkins in structuring the teststructure different. However, I found an improvement in my case which I want to share.
Jenkins中测试结果的层次结构如下:
The hierarchy of test results in Jenkins is the following:
- 包装
- 班级
- 测试名称
可以在<testcase>
-标记中定义以下内容:
Those can be defined within the <testcase>
-tag as the following:
<testcase classname="packagename.classname" name="testname">
因此,您可以在名称"中定义层次结构的最后一部分-测试名称.在类名"中,您可以定义层次结构的前两个部分-包和类,以点分隔.
So within "name" you can define the last part of the hierarchy - the test name. Within "classname" you can define the first two parts of the hierarchy - the package and the class, seperated by a dot.
请记住,只允许一个点.仅通过添加更多的点,而不能在classname标签中添加更多的分离的部分"来创建更深层次的层次结构.如果点数多于一个,则最后一个计数.
Keep in mind that there is only one dot allowed. It is not possible to create a deeper hierarchy by just adding more "seperated parts" in the classname tag only by adding more dots. If there are more dots than one, the last one counts.
如此完整"的示例:
<testsuites name="testsuitesname">
<testsuite name="testsuitename">
<testcase classname="packagename.classname" name="testname">
blabla
</testcase>
</testsuite>
</testsuites>
这篇关于詹金斯测试结果解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!