Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
a2c8673d
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a2c8673d
编写于
7月 23, 2011
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIXED JENKINS-6700] Failure in test class constructor or @Before method was not reported
上级
343d3ac7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
29 addition
and
8 deletion
+29
-8
changelog.html
changelog.html
+3
-0
core/src/main/java/hudson/tasks/junit/SuiteResult.java
core/src/main/java/hudson/tasks/junit/SuiteResult.java
+5
-4
test/src/test/java/hudson/tasks/junit/SuiteResultTest.java
test/src/test/java/hudson/tasks/junit/SuiteResultTest.java
+21
-4
未找到文件。
changelog.html
浏览文件 @
a2c8673d
...
...
@@ -69,6 +69,9 @@ Upcoming changes</a>
<li
class=
bug
>
Fixed Maven build error if headless option is set and MAVEN_OPTS empty
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-10375"
>
issue 10375
</a>
)
<li
class=
bug
>
Tests not recognized as failed if test initialization failed
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-6700"
>
issue 6700
</a>
)
</ul>
</div>
<!--=TRUNK-END=-->
...
...
core/src/main/java/hudson/tasks/junit/SuiteResult.java
浏览文件 @
a2c8673d
...
...
@@ -123,7 +123,8 @@ public final class SuiteResult implements Serializable {
parseSuite
(
xmlReport
,
keepLongStdio
,
r
,
suite
);
// child test cases
if
(
root
.
element
(
"testcase"
)!=
null
)
// FIXME: do this also if no testcases!
if
(
root
.
element
(
"testcase"
)!=
null
||
root
.
element
(
"error"
)!=
null
)
r
.
add
(
new
SuiteResult
(
xmlReport
,
root
,
keepLongStdio
));
}
...
...
@@ -155,11 +156,11 @@ public final class SuiteResult implements Serializable {
}
for
(
Element
e
:
(
List
<
Element
>)
suite
.
elements
(
"testcase"
))
{
// https://
hudson.dev.java.net/issues/show_bug.cgi?id=
1233 indicates that
// https://
issues.jenkins-ci.org/browse/JENKINS-
1233 indicates that
// when <testsuites> is present, we are better off using @classname on the
// individual testcase class.
// https://
hudson.dev.java.net/issues/show_bug.cgi?id=
1463 indicates that
// https://
issues.jenkins-ci.org/browse/JENKINS-
1463 indicates that
// @classname may not exist in individual testcase elements. We now
// also test if the testsuite element has a package name that can be used
// as the class name instead of the file name which is default.
...
...
@@ -168,7 +169,7 @@ public final class SuiteResult implements Serializable {
classname
=
suite
.
attributeValue
(
"name"
);
}
// https://
hudson.dev.java.net/issues/show_bug.cgi?id=
1233 and
// https://
issues.jenkins-ci.org/browse/JENKINS-
1233 and
// http://www.nabble.com/difference-in-junit-publisher-and-ant-junitreport-tf4308604.html#a12265700
// are at odds with each other --- when both are present,
// one wants to use @name from <testsuite>,
...
...
test/src/test/java/hudson/tasks/junit/SuiteResultTest.java
100755 → 100644
浏览文件 @
a2c8673d
...
...
@@ -27,23 +27,25 @@ import java.io.File;
import
java.util.List
;
import
java.net.URISyntaxException
;
import
junit.framework.TestCase
;
import
hudson.XmlFile
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.jvnet.hudson.test.Bug
;
import
java.io.FileWriter
;
import
java.io.PrintWriter
;
import
java.io.Writer
;
import
junit.framework.TestCase
;
/**
* Test cases for parsing JUnit report XML files.
* As there are no XML schema for JUnit xml files, Hudson needs to handle
* varied xml files.
*
* @author Erik Ramfelt
* @author Christoph Kutzinski
*/
public
class
SuiteResultTest
extends
Hudson
TestCase
{
public
class
SuiteResultTest
extends
TestCase
{
private
File
getDataFile
(
String
name
)
throws
URISyntaxException
{
return
new
File
(
SuiteResultTest
.
class
.
getResource
(
name
).
toURI
());
...
...
@@ -179,4 +181,19 @@ public class SuiteResultTest extends HudsonTestCase {
}
}
/**
* When the testcase fails to initialize (exception in constructor or @Before)
* there is no 'testcase' element at all.
*/
@Bug
(
6700
)
public
void
testErrorInTestInitialization
()
throws
Exception
{
SuiteResult
suiteResult
=
parseOne
(
getDataFile
(
"junit-report-6700.xml"
));
assertEquals
(
1
,
suiteResult
.
getCases
().
size
());
CaseResult
result
=
suiteResult
.
getCases
().
get
(
0
);
assertEquals
(
1
,
result
.
getFailCount
());
assertTrue
(
result
.
getErrorStackTrace
()
!=
null
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录