生成正确且完整的 xml 单元测试报告(针对 Hudson)

发布于 2024-09-25 03:06:57 字数 1081 浏览 2 评论 0原文

我正在扩展 svUnit (R 的单元测试套件,sciViews 的一部分),以便它还生成输出哈德森可以阅读。实际上我已经有一些可以做到这一点的东西,但它不处理“停用”测试。

要明白我的意思,请查看 svTestData.R 文件。

问题是我没有找到 Hudson 接受的模式的任何定义,并且我确实设法说服 Java 项目失败和错误,以便它的测试套件会添加 < /code> 和 元素位于几个 元素内,但我没能看到 发生了什么>@Ignore @Test 装饰。

许多其他人也问过同样的问题,例如这里也,但最终有人到达此页面 这是一个很好的起点,但并不完整。例如,它没有提及我通过反复试验发现的 元素。

我试图阅读Hudson阅读的源代码,但我没有找到从哪里开始。

有什么提示吗?

I'm extending svUnit (a unit testing suite for R, part of sciViews) so that it produces also output that can be read by Hudson. actually I already have something that does this, but it does not handle 'deactivated' tests.

to see what I mean, have a look at the protocol_junit.svTestData method in the svTestData.R file.

the problem is that I did not manage to find any definition of the schema accepted by Hudson and I did manage to convince a Java project to fail and error, so that its test suite would add a <failure/> and <error/> element inside of a few <testcase/> elements, but I did not manage to see what happens with a @Ignore @Test decoration.

many others have asked this same question, for example here too, but in the end one gets to this page which is a good starting point but is not complete. for example, it does not mention the <error/> element I discovered by trial and error.

I tried to read the source read by Hudson, but I did not find where to start.

any hints?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最冷一天 2024-10-02 03:06:57

仔细研究了 Hudson 来源(特别是 CaseResult.java) 我看到在 中包含 元素; 元素就是我正在寻找的。

仅供将来参考,我正在生成的模式的 RELAX NG 紧凑语法(随意编辑/维护):

junit.rnc:
#----------------------------------------
start = testsuite

property = element property {
   attribute name {text},
   attribute value {text}
}

properties = element properties {
   property*
}

failure = element failure {
   attribute message {text},
   attribute type {text},
   text
}

error = element error {
   attribute message {text},
   attribute type {text},
   text
}

skipped = element skipped {
   text
}

testcase = element testcase {
   attribute classname {text},
   attribute name {text},
   attribute time {text},
   (failure|error)?,
   skipped?
}

testsuite = element testsuite {
   attribute errors {xsd:integer},
   attribute failures {xsd:integer},
   attribute hostname {text},
   attribute name {text},
   attribute tests {xsd:integer},
   attribute time {xsd:double},
   attribute timestamp {xsd:dateTime},
   properties,
   testcase*,
   element system-out {text},
   element system-err {text}
}
#----------------------------------------


and junitreport.rnc
#----------------------------------------
include "junit.rnc" {
   start = testsuites
   testsuite = element testsuite {
      attribute errors {xsd:integer},
      attribute failures {xsd:integer},
      attribute hostname {text},
      attribute name {text},
      attribute tests {xsd:integer},
      attribute time {xsd:double},
      attribute timestamp {xsd:dateTime},
      attribute id {text},
      attribute package {text},
      properties,
      testcase*,
      element system-out {text},
      element system-err {text}
   }
}

testsuites = element testsuites {
   testsuite*
}
#----------------------------------------

gave a closer look at the Hudson sources (in particular, CaseResult.java) I saw that including a <skipped/> element in a <testcase/> element is what I was looking for.

and just for future reference, the RELAX NG compact syntax of the schema I am producing (feel free to edit/maintain):

junit.rnc:
#----------------------------------------
start = testsuite

property = element property {
   attribute name {text},
   attribute value {text}
}

properties = element properties {
   property*
}

failure = element failure {
   attribute message {text},
   attribute type {text},
   text
}

error = element error {
   attribute message {text},
   attribute type {text},
   text
}

skipped = element skipped {
   text
}

testcase = element testcase {
   attribute classname {text},
   attribute name {text},
   attribute time {text},
   (failure|error)?,
   skipped?
}

testsuite = element testsuite {
   attribute errors {xsd:integer},
   attribute failures {xsd:integer},
   attribute hostname {text},
   attribute name {text},
   attribute tests {xsd:integer},
   attribute time {xsd:double},
   attribute timestamp {xsd:dateTime},
   properties,
   testcase*,
   element system-out {text},
   element system-err {text}
}
#----------------------------------------


and junitreport.rnc
#----------------------------------------
include "junit.rnc" {
   start = testsuites
   testsuite = element testsuite {
      attribute errors {xsd:integer},
      attribute failures {xsd:integer},
      attribute hostname {text},
      attribute name {text},
      attribute tests {xsd:integer},
      attribute time {xsd:double},
      attribute timestamp {xsd:dateTime},
      attribute id {text},
      attribute package {text},
      properties,
      testcase*,
      element system-out {text},
      element system-err {text}
   }
}

testsuites = element testsuites {
   testsuite*
}
#----------------------------------------
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文