Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
7a43fdfa
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,发现更多精彩内容 >>
提交
7a43fdfa
编写于
8月 11, 2014
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reverting portions of patch that were moved to junit-plugin.
上级
6e6ca263
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
176 addition
and
347 deletion
+176
-347
core/src/main/java/hudson/tasks/junit/CaseResult.java
core/src/main/java/hudson/tasks/junit/CaseResult.java
+9
-8
core/src/main/java/hudson/tasks/junit/ClassResult.java
core/src/main/java/hudson/tasks/junit/ClassResult.java
+3
-3
core/src/main/java/hudson/tasks/junit/History.java
core/src/main/java/hudson/tasks/junit/History.java
+10
-12
core/src/main/java/hudson/tasks/junit/JUnitParser.java
core/src/main/java/hudson/tasks/junit/JUnitParser.java
+7
-3
core/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java
...src/main/java/hudson/tasks/junit/JUnitResultArchiver.java
+42
-46
core/src/main/java/hudson/tasks/junit/PackageResult.java
core/src/main/java/hudson/tasks/junit/PackageResult.java
+3
-3
core/src/main/java/hudson/tasks/junit/TestDataPublisher.java
core/src/main/java/hudson/tasks/junit/TestDataPublisher.java
+2
-27
core/src/main/java/hudson/tasks/junit/TestObject.java
core/src/main/java/hudson/tasks/junit/TestObject.java
+3
-38
core/src/main/java/hudson/tasks/junit/TestResult.java
core/src/main/java/hudson/tasks/junit/TestResult.java
+3
-2
core/src/main/java/hudson/tasks/junit/TestResultAction.java
core/src/main/java/hudson/tasks/junit/TestResultAction.java
+5
-26
core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java
...main/java/hudson/tasks/test/AbstractTestResultAction.java
+17
-39
core/src/main/java/hudson/tasks/test/AggregatedTestResultAction.java
...in/java/hudson/tasks/test/AggregatedTestResultAction.java
+6
-38
core/src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java
...n/java/hudson/tasks/test/DefaultTestResultParserImpl.java
+3
-3
core/src/main/java/hudson/tasks/test/SimpleCaseResult.java
core/src/main/java/hudson/tasks/test/SimpleCaseResult.java
+4
-4
core/src/main/java/hudson/tasks/test/TestObject.java
core/src/main/java/hudson/tasks/test/TestObject.java
+9
-14
core/src/main/java/hudson/tasks/test/TestResult.java
core/src/main/java/hudson/tasks/test/TestResult.java
+4
-3
core/src/main/java/hudson/tasks/test/TestResultParser.java
core/src/main/java/hudson/tasks/test/TestResultParser.java
+5
-33
core/src/main/java/hudson/tasks/test/TestResultProjectAction.java
.../main/java/hudson/tasks/test/TestResultProjectAction.java
+4
-18
core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly
.../main/resources/hudson/tasks/junit/CaseResult/index.jelly
+3
-3
core/src/main/resources/hudson/tasks/junit/CaseResult/list.jelly
...c/main/resources/hudson/tasks/junit/CaseResult/list.jelly
+2
-2
core/src/main/resources/hudson/tasks/junit/ClassResult/list.jelly
.../main/resources/hudson/tasks/junit/ClassResult/list.jelly
+2
-2
core/src/main/resources/hudson/tasks/junit/History/index.jelly
...src/main/resources/hudson/tasks/junit/History/index.jelly
+3
-3
core/src/main/resources/hudson/tasks/junit/Messages.properties
...src/main/resources/hudson/tasks/junit/Messages.properties
+2
-0
core/src/main/resources/hudson/tasks/junit/Messages_da.properties
.../main/resources/hudson/tasks/junit/Messages_da.properties
+1
-0
core/src/main/resources/hudson/tasks/junit/Messages_de.properties
.../main/resources/hudson/tasks/junit/Messages_de.properties
+1
-0
core/src/main/resources/hudson/tasks/junit/Messages_es.properties
.../main/resources/hudson/tasks/junit/Messages_es.properties
+1
-0
core/src/main/resources/hudson/tasks/junit/Messages_ja.properties
.../main/resources/hudson/tasks/junit/Messages_ja.properties
+3
-1
core/src/main/resources/hudson/tasks/junit/Messages_pt_BR.properties
...in/resources/hudson/tasks/junit/Messages_pt_BR.properties
+1
-0
core/src/main/resources/hudson/tasks/junit/Messages_zh_TW.properties
...in/resources/hudson/tasks/junit/Messages_zh_TW.properties
+2
-0
core/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly
.../hudson/tasks/test/AbstractTestResultAction/summary.jelly
+1
-1
core/src/main/resources/hudson/tasks/test/MetaTabulatedResult/list.jelly
...esources/hudson/tasks/test/MetaTabulatedResult/list.jelly
+2
-2
core/src/main/resources/hudson/tasks/test/TestObject/sidepanel.jelly
...in/resources/hudson/tasks/test/TestObject/sidepanel.jelly
+4
-4
core/src/main/resources/hudson/tasks/test/TestResult/index.jelly
...c/main/resources/hudson/tasks/test/TestResult/index.jelly
+2
-2
core/src/main/resources/hudson/tasks/test/TestResultProjectAction/index.jelly
...ces/hudson/tasks/test/TestResultProjectAction/index.jelly
+2
-2
core/src/main/resources/hudson/tasks/test/TestResultProjectAction/jobMain.jelly
...s/hudson/tasks/test/TestResultProjectAction/jobMain.jelly
+1
-1
test/src/test/java/hudson/tasks/junit/JUnitParserTest.java
test/src/test/java/hudson/tasks/junit/JUnitParserTest.java
+1
-1
test/src/test/java/hudson/tasks/test/TestResultExtensionTest.java
.../test/java/hudson/tasks/test/TestResultExtensionTest.java
+3
-3
未找到文件。
core/src/main/java/hudson/tasks/junit/CaseResult.java
浏览文件 @
7a43fdfa
...
...
@@ -27,6 +27,7 @@ import hudson.util.TextFile;
import
org.apache.commons.io.FileUtils
;
import
org.jvnet.localizer.Localizable
;
import
hudson.model.AbstractBuild
;
import
hudson.model.Run
;
import
hudson.tasks.test.TestResult
;
...
...
@@ -373,8 +374,8 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
CaseResult
prev
=
getPreviousResult
();
if
(
prev
!=
null
&&
!
prev
.
isPassed
())
this
.
failedSince
=
prev
.
getFailedSince
();
else
if
(
get
Run
()
!=
null
)
{
this
.
failedSince
=
get
Run
().
getNumber
();
else
if
(
get
Owner
()
!=
null
)
{
this
.
failedSince
=
get
Owner
().
getNumber
();
}
else
{
LOGGER
.
warning
(
"trouble calculating getFailedSince. We've got prev, but no owner."
);
// failedSince will be 0, which isn't correct.
...
...
@@ -384,7 +385,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
}
public
Run
<?,?>
getFailedSinceRun
()
{
return
get
Run
().
getParent
().
getBuildByNumber
(
getFailedSince
());
return
get
Owner
().
getParent
().
getBuildByNumber
(
getFailedSince
());
}
/**
...
...
@@ -395,8 +396,8 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
public
int
getAge
()
{
if
(
isPassed
())
return
0
;
else
if
(
get
Run
()
!=
null
)
{
return
get
Run
().
getNumber
()-
getFailedSince
()+
1
;
else
if
(
get
Owner
()
!=
null
)
{
return
get
Owner
().
getNumber
()-
getFailedSince
()+
1
;
}
else
{
LOGGER
.
fine
(
"Trying to get age of a CaseResult without an owner"
);
return
0
;
...
...
@@ -552,14 +553,14 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
}
@Override
public
Run
<?,?>
getRun
()
{
public
AbstractBuild
<?,?>
getOwner
()
{
SuiteResult
sr
=
getSuiteResult
();
if
(
sr
==
null
)
{
LOGGER
.
warning
(
"In getOwner(), getSuiteResult is null"
);
return
null
;
}
hudson
.
tasks
.
junit
.
TestResult
tr
=
sr
.
getParent
();
if
(
tr
==
null
)
{
LOGGER
.
warning
(
"In getOwner(), suiteResult.getParent() is null."
);
return
null
;
}
return
tr
.
get
Run
();
return
tr
.
get
Owner
();
}
public
void
setParentSuiteResult
(
SuiteResult
parent
)
{
...
...
@@ -574,7 +575,7 @@ public class CaseResult extends TestResult implements Comparable<CaseResult> {
if
(
prev
!=
null
&&
!
prev
.
isPassed
())
this
.
failedSince
=
prev
.
failedSince
;
else
this
.
failedSince
=
get
Run
().
getNumber
();
this
.
failedSince
=
get
Owner
().
getNumber
();
}
}
...
...
core/src/main/java/hudson/tasks/junit/ClassResult.java
浏览文件 @
7a43fdfa
...
...
@@ -23,7 +23,7 @@
*/
package
hudson.tasks.junit
;
import
hudson.model.
Run
;
import
hudson.model.
AbstractBuild
;
import
hudson.tasks.test.TabulatedResult
;
import
hudson.tasks.test.TestResult
;
import
hudson.tasks.test.TestObject
;
...
...
@@ -58,8 +58,8 @@ public final class ClassResult extends TabulatedResult implements Comparable<Cla
}
@Override
public
Run
<?,
?>
getRun
()
{
return
(
parent
==
null
?
null
:
parent
.
get
Run
());
public
AbstractBuild
<?,
?>
getOwner
()
{
return
(
parent
==
null
?
null
:
parent
.
get
Owner
());
}
public
PackageResult
getParent
()
{
...
...
core/src/main/java/hudson/tasks/junit/History.java
浏览文件 @
7a43fdfa
...
...
@@ -24,7 +24,6 @@
package
hudson.tasks.junit
;
import
hudson.model.AbstractBuild
;
import
hudson.model.Run
;
import
jenkins.model.Jenkins
;
import
hudson.tasks.test.TestObject
;
import
hudson.tasks.test.TestResult
;
...
...
@@ -69,7 +68,7 @@ public class History {
}
public
boolean
historyAvailable
()
{
if
(
testObject
.
get
Run
().
getParent
().
getBuilds
().
size
()
>
1
)
if
(
testObject
.
get
Owner
().
getParent
().
getBuilds
().
size
()
>
1
)
return
true
;
else
return
false
;
...
...
@@ -77,10 +76,10 @@ public class History {
public
List
<
TestResult
>
getList
(
int
start
,
int
end
)
{
List
<
TestResult
>
list
=
new
ArrayList
<
TestResult
>();
end
=
Math
.
min
(
end
,
testObject
.
get
Run
().
getParent
().
getBuilds
().
size
());
for
(
Run
<?,?>
b:
testObject
.
getRun
().
getParent
().
getBuilds
().
subList
(
start
,
end
))
{
end
=
Math
.
min
(
end
,
testObject
.
get
Owner
().
getParent
().
getBuilds
().
size
());
for
(
AbstractBuild
<?,?>
b:
testObject
.
getOwner
().
getParent
().
getBuilds
().
subList
(
start
,
end
))
{
if
(
b
.
isBuilding
())
continue
;
TestResult
o
=
testObject
.
getResultIn
Run
(
b
);
TestResult
o
=
testObject
.
getResultIn
Build
(
b
);
if
(
o
!=
null
)
{
list
.
add
(
o
);
}
...
...
@@ -89,7 +88,7 @@ public class History {
}
public
List
<
TestResult
>
getList
()
{
return
getList
(
0
,
testObject
.
get
Run
().
getParent
().
getBuilds
().
size
());
return
getList
(
0
,
testObject
.
get
Owner
().
getParent
().
getBuilds
().
size
());
}
/**
...
...
@@ -224,7 +223,7 @@ public class History {
public
String
generateToolTip
(
CategoryDataset
dataset
,
int
row
,
int
column
)
{
ChartLabel
label
=
(
ChartLabel
)
dataset
.
getColumnKey
(
column
);
return
label
.
o
.
get
Run
().
getDisplayName
()
+
" : "
return
label
.
o
.
get
Owner
().
getDisplayName
()
+
" : "
+
label
.
o
.
getDurationString
();
}
};
...
...
@@ -254,14 +253,14 @@ public class History {
}
private
void
generateUrl
()
{
Run
<?,?>
build
=
o
.
getRun
();
AbstractBuild
<?,?>
build
=
o
.
getOwner
();
String
buildLink
=
build
.
getUrl
();
String
actionUrl
=
o
.
getTestResultAction
().
getUrlName
();
this
.
url
=
Jenkins
.
getInstance
().
getRootUrl
()
+
buildLink
+
actionUrl
+
o
.
getUrl
();
}
public
int
compareTo
(
ChartLabel
that
)
{
return
this
.
o
.
get
Run
().
number
-
that
.
o
.
getRun
().
number
;
return
this
.
o
.
get
Owner
().
number
-
that
.
o
.
getOwner
().
number
;
}
@Override
...
...
@@ -284,9 +283,8 @@ public class History {
@Override
public
String
toString
()
{
Run
<?,
?>
run
=
o
.
getRun
();
String
l
=
run
.
getDisplayName
();
String
s
=
run
instanceof
AbstractBuild
?
((
AbstractBuild
)
run
).
getBuiltOnStr
()
:
null
;
String
l
=
o
.
getOwner
().
getDisplayName
();
String
s
=
o
.
getOwner
().
getBuiltOnStr
();
if
(
s
!=
null
)
l
+=
' '
+
s
;
return
l
;
...
...
core/src/main/java/hudson/tasks/junit/JUnitParser.java
浏览文件 @
7a43fdfa
...
...
@@ -25,8 +25,8 @@ package hudson.tasks.junit;
import
hudson.model.TaskListener
;
import
hudson.tasks.test.TestResultParser
;
import
hudson.model.AbstractBuild
;
import
hudson.*
;
import
hudson.model.Run
;
import
hudson.remoting.VirtualChannel
;
import
java.io.IOException
;
...
...
@@ -69,8 +69,8 @@ public class JUnitParser extends TestResultParser {
}
@Override
public
TestResult
parse
Result
(
String
testResultLocations
,
Run
<?,?>
build
,
FilePath
workspace
,
Launcher
launcher
,
public
TestResult
parse
(
String
testResultLocations
,
AbstractBuild
build
,
Launcher
launcher
,
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
...
...
@@ -80,6 +80,10 @@ public class JUnitParser extends TestResultParser {
// [BUG 3123310] TODO - Test Result Refactor: review and fix TestDataPublisher/TestAction subsystem]
// also get code that deals with testDataPublishers from JUnitResultArchiver.perform
FilePath
workspace
=
build
.
getWorkspace
();
if
(
workspace
==
null
)
{
throw
new
AbortException
(
Messages
.
JUnitParser_no_workspace_found
(
build
));
}
return
workspace
.
act
(
new
ParseResultCallable
(
testResultLocations
,
buildTime
,
timeOnMaster
,
keepLongStdio
));
}
...
...
core/src/main/java/hudson/tasks/junit/JUnitResultArchiver.java
浏览文件 @
7a43fdfa
...
...
@@ -30,17 +30,17 @@ import hudson.FilePath;
import
hudson.Launcher
;
import
hudson.model.AbstractBuild
;
import
hudson.model.AbstractProject
;
import
hudson.model.Action
;
import
hudson.model.BuildListener
;
import
hudson.model.Descriptor
;
import
hudson.model.Result
;
import
hudson.model.Run
;
import
hudson.model.Saveable
;
import
hudson.model.TaskListener
;
import
hudson.tasks.BuildStepDescriptor
;
import
hudson.tasks.BuildStepMonitor
;
import
hudson.tasks.Publisher
;
import
hudson.tasks.Recorder
;
import
hudson.tasks.junit.TestResultAction.Data
;
import
hudson.tasks.test.TestResultProjectAction
;
import
hudson.util.DescribableList
;
import
hudson.util.FormValidation
;
import
net.sf.json.JSONObject
;
...
...
@@ -52,18 +52,18 @@ import org.kohsuke.stapler.QueryParameter;
import
org.kohsuke.stapler.StaplerRequest
;
import
java.io.IOException
;
import
java.text.MessageFormat
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
javax.annotation.Nonnull
;
import
jenkins.tasks.SimpleBuildStep
;
import
org.kohsuke.stapler.DataBoundSetter
;
/**
* Generates HTML report from JUnit test result XML files.
*
* @author Kohsuke Kawaguchi
*/
public
class
JUnitResultArchiver
extends
Recorder
implements
SimpleBuildStep
{
public
class
JUnitResultArchiver
extends
Recorder
{
/**
* {@link FileSet} "includes" string, like "foo/bar/*.xml"
...
...
@@ -74,20 +74,24 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
* If true, retain a suite's complete stdout/stderr even if this is huge and the suite passed.
* @since 1.358
*/
private
boolean
keepLongStdio
;
private
final
boolean
keepLongStdio
;
/**
* {@link TestDataPublisher}s configured for this archiver, to process the recorded data.
* For compatibility reasons, can be null.
* @since 1.320
*/
private
DescribableList
<
TestDataPublisher
,
Descriptor
<
TestDataPublisher
>>
testDataPublishers
;
private
final
DescribableList
<
TestDataPublisher
,
Descriptor
<
TestDataPublisher
>>
testDataPublishers
;
private
Double
healthScaleFactor
;
private
final
Double
healthScaleFactor
;
@DataBoundConstructor
/**
* left for backwards compatibility
* @deprecated since 2009-08-09.
*/
@Deprecated
public
JUnitResultArchiver
(
String
testResults
)
{
this
.
testResults
=
testResults
;
this
(
testResults
,
false
,
null
)
;
}
@Deprecated
...
...
@@ -104,44 +108,44 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
this
(
testResults
,
keepLongStdio
,
testDataPublishers
,
1.0
);
}
@D
eprecated
@D
ataBoundConstructor
public
JUnitResultArchiver
(
String
testResults
,
boolean
keepLongStdio
,
DescribableList
<
TestDataPublisher
,
Descriptor
<
TestDataPublisher
>>
testDataPublishers
,
double
healthScaleFactor
)
{
this
.
testResults
=
testResults
;
setKeepLongStdio
(
keepLongStdio
)
;
setTestDataPublishers
(
testDataPublishers
)
;
setHealthScaleFactor
(
healthScaleFactor
);
this
.
keepLongStdio
=
keepLongStdio
;
this
.
testDataPublishers
=
testDataPublishers
;
this
.
healthScaleFactor
=
Math
.
max
(
0.0
,
healthScaleFactor
);
}
private
TestResult
parse
(
String
expandedTestResults
,
Run
<?,?>
run
,
@Nonnull
FilePath
workspace
,
Launcher
launcher
,
TaskListener
listener
)
throws
IOException
,
InterruptedException
{
return
new
JUnitParser
(
isKeepLongStdio
()).
parseResult
(
expandedTestResults
,
run
,
workspace
,
launcher
,
listener
);
}
@Deprecated
/**
* In progress. Working on delegating the actual parsing to the JUnitParser.
*/
protected
TestResult
parse
(
String
expandedTestResults
,
AbstractBuild
build
,
Launcher
launcher
,
BuildListener
listener
)
throws
IOException
,
InterruptedException
{
return
parse
(
expandedTestResults
,
build
,
build
.
getWorkspace
()
,
launcher
,
listener
);
return
new
JUnitParser
(
isKeepLongStdio
()).
parse
(
expandedTestResults
,
build
,
launcher
,
listener
);
}
@Override
public
void
perform
(
Run
build
,
FilePath
workspace
,
Launcher
launcher
,
Task
Listener
listener
)
throws
InterruptedException
,
IOException
{
public
boolean
perform
(
AbstractBuild
build
,
Launcher
launcher
,
Build
Listener
listener
)
throws
InterruptedException
,
IOException
{
listener
.
getLogger
().
println
(
Messages
.
JUnitResultArchiver_Recording
());
TestResultAction
action
;
final
String
testResults
=
build
.
getEnvironment
(
listener
).
expand
(
this
.
testResults
);
try
{
TestResult
result
=
parse
(
testResults
,
build
,
workspace
,
launcher
,
listener
);
TestResult
result
=
parse
(
testResults
,
build
,
launcher
,
listener
);
// TODO can the build argument be omitted now, or is it used prior to the call to addAction?
action
=
new
TestResultAction
(
build
,
result
,
listener
);
try
{
// TODO can the build argument be omitted now, or is it used prior to the call to addAction?
action
=
new
TestResultAction
(
build
,
result
,
listener
);
}
catch
(
NullPointerException
npe
)
{
throw
new
AbortException
(
Messages
.
JUnitResultArchiver_BadXML
(
testResults
));
}
action
.
setHealthScaleFactor
(
getHealthScaleFactor
());
// TODO do we want to move this to the constructor?
result
.
freeze
(
action
);
if
(
result
.
isEmpty
())
{
...
...
@@ -153,7 +157,7 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
List
<
Data
>
data
=
new
ArrayList
<
Data
>();
if
(
testDataPublishers
!=
null
)
{
for
(
TestDataPublisher
tdp
:
testDataPublishers
)
{
Data
d
=
tdp
.
contributeTestData
(
build
,
workspace
,
launcher
,
listener
,
result
);
Data
d
=
tdp
.
getTestData
(
build
,
launcher
,
listener
,
result
);
if
(
d
!=
null
)
{
data
.
add
(
d
);
}
...
...
@@ -165,21 +169,23 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
if
(
build
.
getResult
()
==
Result
.
FAILURE
)
// most likely a build failed before it gets to the test phase.
// don't report confusing error message.
return
;
return
true
;
listener
.
getLogger
().
println
(
e
.
getMessage
());
build
.
setResult
(
Result
.
FAILURE
);
return
;
return
true
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
(
listener
.
error
(
"Failed to archive test reports"
));
build
.
setResult
(
Result
.
FAILURE
);
return
;
return
true
;
}
build
.
addAction
(
action
);
if
(
action
.
getResult
().
getFailCount
()
>
0
)
build
.
setResult
(
Result
.
UNSTABLE
);
return
true
;
}
/**
...
...
@@ -204,19 +210,14 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
return
healthScaleFactor
==
null
?
1.0
:
healthScaleFactor
;
}
/** @since TODO */
public
final
void
setHealthScaleFactor
(
double
healthScaleFactor
)
{
this
.
healthScaleFactor
=
Math
.
max
(
0.0
,
healthScaleFactor
);
}
public
DescribableList
<
TestDataPublisher
,
Descriptor
<
TestDataPublisher
>>
getTestDataPublishers
()
{
return
testDataPublishers
;
}
/** @since TODO */
public
final
void
setTestDataPublishers
(
DescribableList
<
TestDataPublisher
,
Descriptor
<
TestDataPublisher
>>
testDataPublishers
)
{
this
.
testDataPublishers
=
testDataPublishers
;
}
@Override
public
Collection
<
Action
>
getProjectActions
(
AbstractProject
<?,
?>
project
)
{
return
Collections
.<
Action
>
singleton
(
new
TestResultProjectAction
(
project
))
;
}
/**
* @return the keepLongStdio
...
...
@@ -225,11 +226,6 @@ public class JUnitResultArchiver extends Recorder implements SimpleBuildStep {
return
keepLongStdio
;
}
/** @since TODO */
@DataBoundSetter
public
final
void
setKeepLongStdio
(
boolean
keepLongStdio
)
{
this
.
keepLongStdio
=
keepLongStdio
;
}
private
static
final
long
serialVersionUID
=
1L
;
@Extension
...
...
core/src/main/java/hudson/tasks/junit/PackageResult.java
浏览文件 @
7a43fdfa
...
...
@@ -23,7 +23,7 @@
*/
package
hudson.tasks.junit
;
import
hudson.model.
Run
;
import
hudson.model.
AbstractBuild
;
import
hudson.tasks.test.MetaTabulatedResult
;
import
hudson.tasks.test.TestResult
;
import
org.kohsuke.stapler.StaplerRequest
;
...
...
@@ -55,8 +55,8 @@ public final class PackageResult extends MetaTabulatedResult implements Comparab
}
@Override
public
Run
<?,?>
getRun
()
{
return
(
parent
==
null
?
null
:
parent
.
get
Run
());
public
AbstractBuild
<?,
?>
getOwner
()
{
return
(
parent
==
null
?
null
:
parent
.
get
Owner
());
}
public
hudson
.
tasks
.
junit
.
TestResult
getParent
()
{
...
...
core/src/main/java/hudson/tasks/junit/TestDataPublisher.java
浏览文件 @
7a43fdfa
...
...
@@ -26,14 +26,11 @@ package hudson.tasks.junit;
import
hudson.DescriptorExtensionList
;
import
hudson.Extension
;
import
hudson.ExtensionPoint
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.Util
;
import
hudson.model.*
;
import
jenkins.model.Jenkins
;
import
java.io.IOException
;
import
javax.annotation.Nonnull
;
/**
* Contributes {@link TestAction}s to test results.
...
...
@@ -53,32 +50,10 @@ public abstract class TestDataPublisher extends AbstractDescribableImpl<TestData
*
* @return
* can be null to indicate that there's nothing to contribute for this test result.
* @since TODO
*/
public
TestResultAction
.
Data
contributeTestData
(
Run
<?,?>
run
,
@Nonnull
FilePath
workspace
,
Launcher
launcher
,
TaskListener
listener
,
TestResult
testResult
)
throws
IOException
,
InterruptedException
{
if
(
run
instanceof
AbstractBuild
&&
listener
instanceof
BuildListener
)
{
return
getTestData
((
AbstractBuild
)
run
,
launcher
,
(
BuildListener
)
listener
,
testResult
);
}
else
{
throw
new
AbstractMethodError
(
"you must override contributeTestData"
);
}
}
@Deprecated
public
TestResultAction
.
Data
getTestData
(
public
abstract
TestResultAction
.
Data
getTestData
(
AbstractBuild
<?,
?>
build
,
Launcher
launcher
,
BuildListener
listener
,
TestResult
testResult
)
throws
IOException
,
InterruptedException
{
if
(
Util
.
isOverridden
(
TestDataPublisher
.
class
,
getClass
(),
"contributeTestData"
,
Run
.
class
,
FilePath
.
class
,
Launcher
.
class
,
TaskListener
.
class
,
TestResult
.
class
))
{
FilePath
workspace
=
build
.
getWorkspace
();
if
(
workspace
==
null
)
{
throw
new
IOException
(
"no workspace in "
+
build
);
}
return
contributeTestData
(
build
,
workspace
,
launcher
,
listener
,
testResult
);
}
else
{
throw
new
AbstractMethodError
(
"you must override contributeTestData"
);
}
}
BuildListener
listener
,
TestResult
testResult
)
throws
IOException
,
InterruptedException
;
public
static
DescriptorExtensionList
<
TestDataPublisher
,
Descriptor
<
TestDataPublisher
>>
all
()
{
return
Jenkins
.
getInstance
().<
TestDataPublisher
,
Descriptor
<
TestDataPublisher
>>
getDescriptorList
(
TestDataPublisher
.
class
);
...
...
core/src/main/java/hudson/tasks/junit/TestObject.java
浏览文件 @
7a43fdfa
...
...
@@ -23,11 +23,9 @@
*/
package
hudson.tasks.junit
;
import
hudson.Util
;
import
hudson.model.AbstractBuild
;
import
hudson.model.AbstractModelObject
;
import
hudson.model.Api
;
import
hudson.model.Run
;
import
hudson.tasks.test.AbstractTestResultAction
;
import
org.kohsuke.stapler.export.ExportedBean
;
...
...
@@ -46,23 +44,8 @@ import java.util.List;
*/
@ExportedBean
public
abstract
class
TestObject
extends
AbstractModelObject
implements
Serializable
{
public
abstract
AbstractBuild
<?,?>
getOwner
()
;
@Deprecated
public
AbstractBuild
<?,?>
getOwner
()
{
if
(
Util
.
isOverridden
(
TestObject
.
class
,
getClass
(),
"getRun"
))
{
Run
<?,?>
r
=
getRun
();
return
r
instanceof
AbstractBuild
?
(
AbstractBuild
)
r
:
null
;
}
else
{
throw
new
AbstractMethodError
(
"you must override getRun"
);
}
}
/**
* @since TODO
*/
public
Run
<?,?>
getRun
()
{
return
getOwner
();
}
public
abstract
TestObject
getParent
();
...
...
@@ -86,26 +69,8 @@ public abstract class TestObject extends AbstractModelObject implements Serializ
* @return null if no such counter part exists.
*/
public
abstract
TestObject
getPreviousResult
();
@Deprecated
public
TestObject
getResultInBuild
(
AbstractBuild
<?,?>
build
)
{
if
(
Util
.
isOverridden
(
TestObject
.
class
,
getClass
(),
"getResultInRun"
,
Run
.
class
))
{
return
getResultInRun
(
build
);
}
else
{
throw
new
AbstractMethodError
(
"you must override getResultInRun"
);
}
}
/**
* @since TODO
*/
public
TestObject
getResultInRun
(
Run
<?,?>
run
)
{
if
(
run
instanceof
AbstractBuild
)
{
return
getResultInBuild
((
AbstractBuild
)
run
);
}
else
{
throw
new
AbstractMethodError
(
"you must override getResultInRun"
);
}
}
public
abstract
TestObject
getResultInBuild
(
AbstractBuild
<?,?>
build
);
/**
* Time took to run this test. In seconds.
...
...
core/src/main/java/hudson/tasks/junit/TestResult.java
浏览文件 @
7a43fdfa
...
...
@@ -25,6 +25,7 @@ package hudson.tasks.junit;
import
hudson.AbortException
;
import
hudson.Util
;
import
hudson.model.AbstractBuild
;
import
hudson.model.Run
;
import
hudson.tasks.test.AbstractTestResultAction
;
import
hudson.tasks.test.MetaTabulatedResult
;
...
...
@@ -295,8 +296,8 @@ public final class TestResult extends MetaTabulatedResult {
}
@Override
public
Run
<?,?>
getRun
()
{
return
(
parentAction
==
null
?
null
:
parentAction
.
run
);
public
AbstractBuild
<?,?>
getOwner
()
{
return
(
parentAction
==
null
?
null
:
parentAction
.
owner
);
}
@Override
...
...
core/src/main/java/hudson/tasks/junit/TestResultAction.java
浏览文件 @
7a43fdfa
...
...
@@ -26,13 +26,11 @@ package hudson.tasks.junit;
import
com.thoughtworks.xstream.XStream
;
import
hudson.XmlFile
;
import
hudson.model.AbstractBuild
;
import
hudson.model.AbstractProject
;
import
hudson.model.Action
;
import
hudson.model.BuildListener
;
import
hudson.model.Run
;
import
hudson.model.TaskListener
;
import
hudson.tasks.test.AbstractTestResultAction
;
import
hudson.tasks.test.TestObject
;
import
hudson.tasks.test.TestResultProjectAction
;
import
hudson.util.HeapSpaceStringConverter
;
import
hudson.util.XStream2
;
import
org.kohsuke.stapler.StaplerProxy
;
...
...
@@ -41,12 +39,10 @@ import java.io.File;
import
java.io.IOException
;
import
java.lang.ref.WeakReference
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
jenkins.tasks.SimpleBuildStep
;
/**
* {@link Action} that displays the JUnit test result.
...
...
@@ -57,7 +53,7 @@ import jenkins.tasks.SimpleBuildStep;
*
* @author Kohsuke Kawaguchi
*/
public
class
TestResultAction
extends
AbstractTestResultAction
<
TestResultAction
>
implements
StaplerProxy
,
SimpleBuildStep
.
LastBuildAction
{
public
class
TestResultAction
extends
AbstractTestResultAction
<
TestResultAction
>
implements
StaplerProxy
{
private
transient
WeakReference
<
TestResult
>
result
;
// Hudson < 1.25 didn't set these fields, so use Integer
...
...
@@ -70,13 +66,6 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
@Deprecated
public
TestResultAction
(
AbstractBuild
owner
,
TestResult
result
,
BuildListener
listener
)
{
this
((
Run
)
owner
,
result
,
listener
);
}
/**
* @since TODO
*/
public
TestResultAction
(
Run
owner
,
TestResult
result
,
TaskListener
listener
)
{
super
(
owner
);
setResult
(
result
,
listener
);
}
...
...
@@ -86,15 +75,10 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
this
(
null
,
result
,
listener
);
}
@Override
public
Collection
<?
extends
Action
>
getProjectActions
()
{
return
Collections
.<
Action
>
singleton
(
new
TestResultProjectAction
(
run
.
getParent
()));
}
/**
* Overwrites the {@link TestResult} by a new data set.
* @since TODO
*/
public
synchronized
void
setResult
(
TestResult
result
,
Task
Listener
listener
)
{
public
synchronized
void
setResult
(
TestResult
result
,
Build
Listener
listener
)
{
result
.
freeze
(
this
);
totalCount
=
result
.
getTotalCount
();
...
...
@@ -111,13 +95,8 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
this
.
result
=
new
WeakReference
<
TestResult
>(
result
);
}
@Deprecated
public
void
setResult
(
TestResult
result
,
BuildListener
listener
)
{
setResult
(
result
,
(
TaskListener
)
listener
);
}
private
XmlFile
getDataFile
()
{
return
new
XmlFile
(
XSTREAM
,
new
File
(
run
.
getRootDir
(),
"junitResult.xml"
));
return
new
XmlFile
(
XSTREAM
,
new
File
(
owner
.
getRootDir
(),
"junitResult.xml"
));
}
public
synchronized
TestResult
getResult
()
{
...
...
@@ -215,7 +194,7 @@ public class TestResultAction extends AbstractTestResultAction<TestResultAction>
* Resolves {@link TestAction}s for the given {@link TestObject}.
*
* <p>
* This object itself is persisted as a part of {@link
Run
}, so it needs to be XStream-serializable.
* This object itself is persisted as a part of {@link
AbstractBuild
}, so it needs to be XStream-serializable.
*
* @see TestDataPublisher
*/
...
...
core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java
浏览文件 @
7a43fdfa
...
...
@@ -37,7 +37,6 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
jenkins.model.RunAction2
;
import
jenkins.model.lazy.LazyBuildMixIn
;
import
org.jfree.chart.ChartFactory
;
import
org.jfree.chart.JFreeChart
;
import
org.jfree.chart.axis.CategoryAxis
;
...
...
@@ -65,12 +64,6 @@ import org.kohsuke.stapler.export.ExportedBean;
*/
@ExportedBean
public
abstract
class
AbstractTestResultAction
<
T
extends
AbstractTestResultAction
>
implements
HealthReportingAction
,
RunAction2
{
/**
* @since TODO
*/
public
transient
Run
<?,?>
run
;
@Deprecated
public
transient
AbstractBuild
<?,?>
owner
;
private
Map
<
String
,
String
>
descriptions
=
new
ConcurrentHashMap
<
String
,
String
>();
...
...
@@ -78,28 +71,18 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
/** @since 1.545 */
protected
AbstractTestResultAction
()
{}
/**
* @deprecated Use the default constructor and just call {@link Run#addAction} to associate the build with the action.
* @since TODO
*/
@Deprecated
protected
AbstractTestResultAction
(
Run
owner
)
{
onAttached
(
owner
);
}
/** @deprecated Use the default constructor and just call {@link Run#addAction} to associate the build with the action. */
@Deprecated
protected
AbstractTestResultAction
(
AbstractBuild
owner
)
{
this
((
Run
)
owner
)
;
this
.
owner
=
owner
;
}
@Override
public
void
onAttached
(
Run
<?,
?>
r
)
{
this
.
run
=
r
;
this
.
owner
=
r
instanceof
AbstractBuild
?
(
AbstractBuild
<?,?>)
r
:
null
;
this
.
owner
=
(
AbstractBuild
<?,?>)
r
;
}
@Override
public
void
onLoad
(
Run
<?,
?>
r
)
{
this
.
run
=
r
;
this
.
owner
=
r
instanceof
AbstractBuild
?
(
AbstractBuild
<?,?>)
r
:
null
;
this
.
owner
=
(
AbstractBuild
<?,?>)
r
;
}
/**
...
...
@@ -209,15 +192,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
}
private
<
U
extends
AbstractTestResultAction
>
U
getPreviousResult
(
Class
<
U
>
type
,
boolean
eager
)
{
Run
<?,?>
b
=
run
;
Set
<
Integer
>
loadedBuilds
;
if
(!
eager
&&
run
.
getParent
()
instanceof
LazyBuildMixIn
.
LazyLoadingJob
)
{
loadedBuilds
=
((
LazyBuildMixIn
.
LazyLoadingJob
<?,?>)
run
.
getParent
()).
getLazyBuildMixIn
().
_getRuns
().
getLoadedBuilds
().
keySet
();
}
else
{
loadedBuilds
=
null
;
}
Set
<
Integer
>
loadedBuilds
=
eager
?
null
:
owner
.
getProject
().
_getRuns
().
getLoadedBuilds
().
keySet
();
AbstractBuild
<?,?>
b
=
owner
;
while
(
true
)
{
b
=
loadedBuilds
==
null
||
loadedBuilds
.
contains
(
b
.
number
-
/* assuming there are no gaps */
1
)
?
b
.
getPreviousBuild
()
:
null
;
b
=
eager
||
loadedBuilds
.
contains
(
b
.
number
-
/* assuming there are no gaps */
1
)
?
b
.
getPreviousBuild
()
:
null
;
if
(
b
==
null
)
return
null
;
U
r
=
b
.
getAction
(
type
);
...
...
@@ -259,7 +237,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
return
;
}
if
(
req
.
checkIfModified
(
run
.
getTimestamp
(),
rsp
))
if
(
req
.
checkIfModified
(
owner
.
getTimestamp
(),
rsp
))
return
;
ChartUtil
.
generateGraph
(
req
,
rsp
,
createChart
(
req
,
buildDataSet
(
req
)),
calcDefaultSize
());
...
...
@@ -269,7 +247,7 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
* Generates a clickable map HTML for {@link #doGraph(StaplerRequest, StaplerResponse)}.
*/
public
void
doGraphMap
(
StaplerRequest
req
,
StaplerResponse
rsp
)
throws
IOException
{
if
(
req
.
checkIfModified
(
run
.
getTimestamp
(),
rsp
))
if
(
req
.
checkIfModified
(
owner
.
getTimestamp
(),
rsp
))
return
;
ChartUtil
.
generateClickableMap
(
req
,
rsp
,
createChart
(
req
,
buildDataSet
(
req
)),
calcDefaultSize
());
}
...
...
@@ -301,10 +279,10 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
DataSetBuilder
<
String
,
NumberOnlyBuildLabel
>
dsb
=
new
DataSetBuilder
<
String
,
NumberOnlyBuildLabel
>();
for
(
AbstractTestResultAction
<?>
a
=
this
;
a
!=
null
;
a
=
a
.
getPreviousResult
(
AbstractTestResultAction
.
class
,
false
))
{
dsb
.
add
(
a
.
getFailCount
(),
"failed"
,
new
NumberOnlyBuildLabel
(
a
.
run
));
dsb
.
add
(
a
.
getFailCount
(),
"failed"
,
new
NumberOnlyBuildLabel
(
a
.
owner
));
if
(!
failureOnly
)
{
dsb
.
add
(
a
.
getSkipCount
(),
"skipped"
,
new
NumberOnlyBuildLabel
(
a
.
run
));
dsb
.
add
(
a
.
getTotalCount
()-
a
.
getFailCount
()-
a
.
getSkipCount
(),
"total"
,
new
NumberOnlyBuildLabel
(
a
.
run
));
dsb
.
add
(
a
.
getSkipCount
(),
"skipped"
,
new
NumberOnlyBuildLabel
(
a
.
owner
));
dsb
.
add
(
a
.
getTotalCount
()-
a
.
getFailCount
()-
a
.
getSkipCount
(),
"total"
,
new
NumberOnlyBuildLabel
(
a
.
owner
));
}
}
return
dsb
.
build
();
...
...
@@ -359,20 +337,20 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
@Override
public
String
generateURL
(
CategoryDataset
dataset
,
int
row
,
int
column
)
{
NumberOnlyBuildLabel
label
=
(
NumberOnlyBuildLabel
)
dataset
.
getColumnKey
(
column
);
return
relPath
+
label
.
getRun
()
.
getNumber
()+
"/testReport/"
;
return
relPath
+
label
.
build
.
getNumber
()+
"/testReport/"
;
}
@Override
public
String
generateToolTip
(
CategoryDataset
dataset
,
int
row
,
int
column
)
{
NumberOnlyBuildLabel
label
=
(
NumberOnlyBuildLabel
)
dataset
.
getColumnKey
(
column
);
AbstractTestResultAction
a
=
label
.
getRun
()
.
getAction
(
AbstractTestResultAction
.
class
);
AbstractTestResultAction
a
=
label
.
build
.
getAction
(
AbstractTestResultAction
.
class
);
switch
(
row
)
{
case
0
:
return
String
.
valueOf
(
Messages
.
AbstractTestResultAction_fail
(
label
.
getRun
()
.
getDisplayName
(),
a
.
getFailCount
()));
return
String
.
valueOf
(
Messages
.
AbstractTestResultAction_fail
(
label
.
build
.
getDisplayName
(),
a
.
getFailCount
()));
case
1
:
return
String
.
valueOf
(
Messages
.
AbstractTestResultAction_skip
(
label
.
getRun
()
.
getDisplayName
(),
a
.
getSkipCount
()));
return
String
.
valueOf
(
Messages
.
AbstractTestResultAction_skip
(
label
.
build
.
getDisplayName
(),
a
.
getSkipCount
()));
default
:
return
String
.
valueOf
(
Messages
.
AbstractTestResultAction_test
(
label
.
getRun
()
.
getDisplayName
(),
a
.
getTotalCount
()));
return
String
.
valueOf
(
Messages
.
AbstractTestResultAction_test
(
label
.
build
.
getDisplayName
(),
a
.
getTotalCount
()));
}
}
};
...
...
core/src/main/java/hudson/tasks/test/AggregatedTestResultAction.java
浏览文件 @
7a43fdfa
...
...
@@ -23,9 +23,7 @@
*/
package
hudson.tasks.test
;
import
hudson.Util
;
import
hudson.model.AbstractBuild
;
import
hudson.model.Run
;
import
org.kohsuke.stapler.export.Exported
;
import
org.kohsuke.stapler.export.ExportedBean
;
...
...
@@ -35,7 +33,7 @@ import java.util.List;
/**
* {@link AbstractTestResultAction} that aggregates all the test results
* from the corresponding {@link
Run
}s.
* from the corresponding {@link
AbstractBuild
}s.
*
* <p>
* (This has nothing to do with {@link AggregatedTestResultPublisher}, unfortunately)
...
...
@@ -123,27 +121,13 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
*/
@ExportedBean
(
defaultVisibility
=
2
)
public
static
final
class
ChildReport
{
@
Depreca
ted
@
Expor
ted
public
final
AbstractBuild
<?,?>
child
;
/**
* @since TODO
*/
@Exported
(
name
=
"child"
)
public
final
Run
<?,?>
run
;
@Exported
public
final
Object
result
;
@Deprecated
public
ChildReport
(
AbstractBuild
<?,
?>
child
,
AbstractTestResultAction
result
)
{
this
((
Run
)
child
,
result
);
}
/**
* @since TODO
*/
public
ChildReport
(
Run
<?,?>
run
,
AbstractTestResultAction
result
)
{
this
.
child
=
run
instanceof
AbstractBuild
?
(
AbstractBuild
)
run
:
null
;
this
.
run
=
run
;
this
.
child
=
child
;
this
.
result
=
result
!=
null
?
result
.
getResult
()
:
null
;
}
}
...
...
@@ -156,7 +140,7 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
return
new
AbstractList
<
ChildReport
>()
{
public
ChildReport
get
(
int
index
)
{
return
new
ChildReport
(
resolve
Run
(
children
.
get
(
index
)),
resolve
Child
(
children
.
get
(
index
)),
getChildReport
(
children
.
get
(
index
)));
}
...
...
@@ -167,30 +151,14 @@ public abstract class AggregatedTestResultAction extends AbstractTestResultActio
}
protected
abstract
String
getChildName
(
AbstractTestResultAction
tr
);
/**
* @since TODO
*/
public
Run
<?,?>
resolveRun
(
Child
child
)
{
return
resolveChild
(
child
);
}
@Deprecated
public
AbstractBuild
<?,?>
resolveChild
(
Child
child
)
{
if
(
Util
.
isOverridden
(
AggregatedTestResultAction
.
class
,
getClass
(),
"resolveRun"
,
Child
.
class
))
{
Run
<?,?>
r
=
resolveRun
(
child
);
return
r
instanceof
AbstractBuild
?
(
AbstractBuild
)
r
:
null
;
}
else
{
throw
new
AbstractMethodError
(
"you must override resolveRun"
);
}
}
public
abstract
AbstractBuild
<?,?>
resolveChild
(
Child
child
);
/**
* Uses {@link #resolveChild(Child)} and obtain the
* {@link AbstractTestResultAction} object for the given child.
*/
protected
AbstractTestResultAction
getChildReport
(
Child
child
)
{
Run
<?,?>
b
=
resolveRun
(
child
);
AbstractBuild
<?,?>
b
=
resolveChild
(
child
);
if
(
b
==
null
)
return
null
;
return
b
.
getAction
(
AbstractTestResultAction
.
class
);
}
...
...
core/src/main/java/hudson/tasks/test/DefaultTestResultParserImpl.java
浏览文件 @
7a43fdfa
...
...
@@ -28,7 +28,7 @@ import hudson.FilePath;
import
hudson.FilePath.FileCallable
;
import
hudson.Launcher
;
import
hudson.Util
;
import
hudson.model.
Run
;
import
hudson.model.
AbstractBuild
;
import
hudson.model.TaskListener
;
import
hudson.remoting.VirtualChannel
;
...
...
@@ -73,8 +73,8 @@ public abstract class DefaultTestResultParserImpl extends TestResultParser imple
protected
abstract
TestResult
parse
(
List
<
File
>
reportFiles
,
Launcher
launcher
,
TaskListener
listener
)
throws
InterruptedException
,
IOException
;
@Override
public
TestResult
parse
Result
(
final
String
testResultLocations
,
final
Run
<?,?>
build
,
FilePath
workspace
,
final
Launcher
launcher
,
final
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
return
workspace
.
act
(
new
FileCallable
<
TestResult
>()
{
public
TestResult
parse
(
final
String
testResultLocations
,
final
AbstractBuild
build
,
final
Launcher
launcher
,
final
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
return
build
.
getWorkspace
()
.
act
(
new
FileCallable
<
TestResult
>()
{
final
boolean
ignoreTimestampCheck
=
IGNORE_TIMESTAMP_CHECK
;
// so that the property can be set on the master
final
long
buildTime
=
build
.
getTimestamp
().
getTimeInMillis
();
final
long
nowMaster
=
System
.
currentTimeMillis
();
...
...
core/src/main/java/hudson/tasks/test/SimpleCaseResult.java
浏览文件 @
7a43fdfa
...
...
@@ -23,7 +23,7 @@
*/
package
hudson.tasks.test
;
import
hudson.model.
Run
;
import
hudson.model.
AbstractBuild
;
import
hudson.tasks.junit.TestAction
;
import
java.util.Collection
;
...
...
@@ -189,12 +189,12 @@ public class SimpleCaseResult extends TestResult {
}
@Override
public
Run
<?,?>
getRun
()
{
public
AbstractBuild
<?,?>
getOwner
()
{
if
(
parentAction
==
null
)
{
LOGGER
.
warning
(
"in Trivial Test Result, parentAction is null, but get
Run
() called"
);
LOGGER
.
warning
(
"in Trivial Test Result, parentAction is null, but get
Owner
() called"
);
return
null
;
}
return
parentAction
.
run
;
return
parentAction
.
owner
;
}
@Override
...
...
core/src/main/java/hudson/tasks/test/TestObject.java
浏览文件 @
7a43fdfa
...
...
@@ -56,6 +56,8 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
TestObject
.
class
.
getName
());
private
volatile
transient
String
id
;
public
abstract
AbstractBuild
<?,
?>
getOwner
();
/**
* Reverse pointer of {@link TabulatedResult#getChildren()}.
*/
...
...
@@ -156,7 +158,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
buf
.
insert
(
0
,
action
.
getUrlName
());
// Now the build
Run
<?,?>
myBuild
=
cur
.
getRun
();
AbstractBuild
<?,?>
myBuild
=
cur
.
getOwner
();
if
(
myBuild
==
null
)
{
LOGGER
.
warning
(
"trying to get relative path, but we can't determine the build that owns this result."
);
return
""
;
// this won't take us to the right place, but it also won't 404.
...
...
@@ -199,7 +201,7 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
*/
@Override
public
AbstractTestResultAction
getTestResultAction
()
{
Run
<?,
?>
owner
=
getRun
();
AbstractBuild
<?,
?>
owner
=
getOwner
();
if
(
owner
!=
null
)
{
return
owner
.
getAction
(
AbstractTestResultAction
.
class
);
}
else
{
...
...
@@ -244,19 +246,12 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
*/
public
abstract
TestResult
getPreviousResult
();
@Deprecated
public
TestResult
getResultInBuild
(
AbstractBuild
<?,
?>
build
)
{
return
(
TestResult
)
super
.
getResultInBuild
(
build
);
}
/**
* Gets the counterpart of this {@link TestResult} in the specified run.
*
* @return null if no such counter part exists.
*/
@Override
public
TestResult
getResultInRun
(
Run
<?,?>
run
)
{
return
(
TestResult
)
super
.
getResultInRun
(
run
);
}
public
abstract
TestResult
getResultInBuild
(
AbstractBuild
<?,
?>
build
);
/**
* Find the test result corresponding to the one identified by <code>id></code>
...
...
@@ -424,12 +419,12 @@ public abstract class TestObject extends hudson.tasks.junit.TestObject {
public
synchronized
HttpResponse
doSubmitDescription
(
@QueryParameter
String
description
)
throws
IOException
,
ServletException
{
if
(
get
Run
()
==
null
)
{
LOGGER
.
severe
(
"get
Run
() is null, can't save description."
);
if
(
get
Owner
()
==
null
)
{
LOGGER
.
severe
(
"get
Owner
() is null, can't save description."
);
}
else
{
get
Run
().
checkPermission
(
Run
.
UPDATE
);
get
Owner
().
checkPermission
(
Run
.
UPDATE
);
setDescription
(
description
);
get
Run
().
save
();
get
Owner
().
save
();
}
return
new
HttpRedirect
(
"."
);
...
...
core/src/main/java/hudson/tasks/test/TestResult.java
浏览文件 @
7a43fdfa
...
...
@@ -24,6 +24,7 @@
package
hudson.tasks.test
;
import
hudson.tasks.junit.TestAction
;
import
hudson.model.AbstractBuild
;
import
hudson.model.Run
;
import
hudson.model.Result
;
...
...
@@ -54,7 +55,7 @@ public abstract class TestResult extends TestObject {
* this test result.
*/
public
AbstractTestResultAction
getParentAction
()
{
return
get
Run
().
getAction
(
AbstractTestResultAction
.
class
);
return
get
Owner
().
getAction
(
AbstractTestResultAction
.
class
);
}
/**
...
...
@@ -129,7 +130,7 @@ public abstract class TestResult extends TestObject {
* @return null if no such counter part exists.
*/
public
TestResult
getPreviousResult
()
{
Run
<?,?>
b
=
getRun
();
AbstractBuild
<?,?>
b
=
getOwner
();
if
(
b
==
null
)
{
return
null
;
}
...
...
@@ -151,7 +152,7 @@ public abstract class TestResult extends TestObject {
*
* @return null if no such counter part exists.
*/
@Override
public
TestResult
getResultInRun
(
Run
<?,?>
build
)
{
public
TestResult
getResultInBuild
(
AbstractBuild
<?,?>
build
)
{
AbstractTestResultAction
tra
=
build
.
getAction
(
getParentAction
().
getClass
());
if
(
tra
==
null
)
{
tra
=
build
.
getAction
(
AbstractTestResultAction
.
class
);
...
...
core/src/main/java/hudson/tasks/test/TestResultParser.java
浏览文件 @
7a43fdfa
...
...
@@ -26,17 +26,13 @@ package hudson.tasks.test;
import
hudson.AbortException
;
import
hudson.ExtensionList
;
import
hudson.ExtensionPoint
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.Util
;
import
hudson.model.AbstractBuild
;
import
hudson.model.Run
;
import
jenkins.model.Jenkins
;
import
hudson.model.TaskListener
;
import
hudson.tasks.Publisher
;
import
java.io.IOException
;
import
javax.annotation.Nonnull
;
/**
* Parses test result files and builds in-memory representation of it as {@link TestResult}.
...
...
@@ -52,7 +48,7 @@ import javax.annotation.Nonnull;
* which handles a set of default error checks on user inputs.
*
* <p>
* Parsers are stateless, and the {@link #parse
Result
} method
* Parsers are stateless, and the {@link #parse
(String, AbstractBuild, Launcher, TaskListener)
} method
* can be concurrently invoked by multiple threads for different builds.
*
* @since 1.343
...
...
@@ -100,11 +96,10 @@ public abstract class TestResultParser implements ExtensionPoint {
* </ul>
*
* @param testResultLocations
* GLOB pattern relative to the {@
code
workspace} that
* GLOB pattern relative to the {@
linkplain AbstractBuild#getWorkspace()
workspace} that
* specifies the locations of the test result files. Never null.
* @param
run
* @param
build
* Build for which these tests are parsed. Never null.
* @param workspace the workspace in which tests can be found
* @param launcher
* Can be used to fork processes on the machine where the build is running. Never null.
* @param listener
...
...
@@ -119,32 +114,9 @@ public abstract class TestResultParser implements ExtensionPoint {
* @throws AbortException
* If you encounter an error that you handled gracefully, throw this exception and Hudson
* will not show a stack trace.
* @since TODO
*/
public
TestResult
parseResult
(
String
testResultLocations
,
Run
<?,?>
run
,
@Nonnull
FilePath
workspace
,
Launcher
launcher
,
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
if
(
run
instanceof
AbstractBuild
)
{
return
parse
(
testResultLocations
,
(
AbstractBuild
)
run
,
launcher
,
listener
);
}
else
{
throw
new
AbstractMethodError
(
"you must override parseResult"
);
}
}
@Deprecated
public
TestResult
parse
(
String
testResultLocations
,
public
abstract
TestResult
parse
(
String
testResultLocations
,
AbstractBuild
build
,
Launcher
launcher
,
TaskListener
listener
)
throws
InterruptedException
,
IOException
{
if
(
Util
.
isOverridden
(
TestResultParser
.
class
,
getClass
(),
"parseResult"
,
String
.
class
,
Run
.
class
,
FilePath
.
class
,
Launcher
.
class
,
TaskListener
.
class
))
{
FilePath
workspace
=
build
.
getWorkspace
();
if
(
workspace
==
null
)
{
throw
new
AbortException
(
"no workspace in "
+
build
);
}
return
parseResult
(
testResultLocations
,
build
,
workspace
,
launcher
,
listener
);
}
else
{
throw
new
AbstractMethodError
(
"you must override parseResult"
);
}
}
throws
InterruptedException
,
IOException
;
}
core/src/main/java/hudson/tasks/test/TestResultProjectAction.java
浏览文件 @
7a43fdfa
...
...
@@ -23,10 +23,9 @@
*/
package
hudson.tasks.test
;
import
hudson.model.AbstractBuild
;
import
hudson.model.AbstractProject
;
import
hudson.model.Action
;
import
hudson.model.Job
;
import
hudson.model.Run
;
import
hudson.tasks.junit.JUnitResultArchiver
;
import
org.kohsuke.stapler.Ancestor
;
import
org.kohsuke.stapler.StaplerRequest
;
...
...
@@ -50,24 +49,11 @@ import java.util.List;
public
class
TestResultProjectAction
implements
Action
{
/**
* Project that owns this action.
* @since TODO
*/
public
final
Job
<?,?>
job
;
@Deprecated
public
final
AbstractProject
<?,?>
project
;
/**
* @since TODO
*/
public
TestResultProjectAction
(
Job
<?,?>
job
)
{
this
.
job
=
job
;
project
=
job
instanceof
AbstractProject
?
(
AbstractProject
)
job
:
null
;
}
@Deprecated
public
TestResultProjectAction
(
AbstractProject
<?,?>
project
)
{
this
((
Job
)
project
)
;
this
.
project
=
project
;
}
/**
...
...
@@ -86,9 +72,9 @@ public class TestResultProjectAction implements Action {
}
public
AbstractTestResultAction
getLastTestResultAction
()
{
final
Run
<?,?>
tb
=
job
.
getLastSuccessfulBuild
();
final
AbstractBuild
<?,?>
tb
=
project
.
getLastSuccessfulBuild
();
Run
<?,?>
b
=
job
.
getLastBuild
();
AbstractBuild
<?,?>
b
=
project
.
getLastBuild
();
while
(
b
!=
null
)
{
AbstractTestResultAction
a
=
b
.
getAction
(
AbstractTestResultAction
.
class
);
if
(
a
!=
null
&&
(!
b
.
isBuilding
()))
return
a
;
...
...
core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly
浏览文件 @
7a43fdfa
...
...
@@ -25,7 +25,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define"
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<l:layout title="${it.
run
} test - ${it.displayName}">
<l:layout title="${it.
owner
} test - ${it.displayName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<j:set var="st" value="${it.status}" />
...
...
@@ -50,7 +50,7 @@ THE SOFTWARE.
${%failingFor(it.age)}
</j:otherwise>
</j:choose>
(${%since.before}<t:buildLink job="${it.
run.paren
t}" number="${it.failedSince}"/>${%since.after})
(${%since.before}<t:buildLink job="${it.
owner.projec
t}" number="${it.failedSince}"/>${%since.after})
</div>
</j:if>
...
...
@@ -60,7 +60,7 @@ THE SOFTWARE.
</a>
</div>
<t:editableDescription permission="${it.
run
.UPDATE}"/>
<t:editableDescription permission="${it.
owner
.UPDATE}"/>
<table style="margin-top: 1em; margin-left:0em;">
<j:forEach var="action" items="${it.testActions}">
...
...
core/src/main/resources/hudson/tasks/junit/CaseResult/list.jelly
浏览文件 @
7a43fdfa
...
...
@@ -36,8 +36,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Test Result}</td>
</tr>
<tbody>
<j:forEach var="b" items="${it.
run
.parent.builds}" begin="${start}" end="${end}">
<j:set var="test" value="${it.getResultIn
Run
(b)}"/>
<j:forEach var="b" items="${it.
owner
.parent.builds}" begin="${start}" end="${end}">
<j:set var="test" value="${it.getResultIn
Build
(b)}"/>
<j:if test="${test != null}">
<tr>
<td class="pane">
...
...
core/src/main/resources/hudson/tasks/junit/ClassResult/list.jelly
浏览文件 @
7a43fdfa
...
...
@@ -35,8 +35,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Total}</td>
</tr>
<tbody>
<j:forEach var="b" items="${it.
run
.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultIn
Run
(b)}"/>
<j:forEach var="b" items="${it.
owner
.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultIn
Build
(b)}"/>
<j:if test="${p != null}">
<tr>
<td class="pane">
...
...
core/src/main/resources/hudson/tasks/junit/History/index.jelly
浏览文件 @
7a43fdfa
...
...
@@ -67,11 +67,11 @@ THE SOFTWARE.
<st:include from="${it.testObject}" it="${it.testObject}" page="list.jelly" optional="true"/>
<div>
<j:if test="${start > 0}">
<a href="${app.rootUrl}${it.testObject.
run
.url}testReport${it.testObject.url}/history${(start-25)>0?'?start='+(start-25):''}">${%Newer}</a>
<a href="${app.rootUrl}${it.testObject.
owner
.url}testReport${it.testObject.url}/history${(start-25)>0?'?start='+(start-25):''}">${%Newer}</a>
</j:if>
<j:if test="${it.testObject.
run.paren
t.builds.size() > end}">
<a href="${app.rootUrl}${it.testObject.
run
.url}testReport${it.testObject.url}/history?start=${end+1}">${%Older}</a>
<j:if test="${it.testObject.
owner.projec
t.builds.size() > end}">
<a href="${app.rootUrl}${it.testObject.
owner
.url}testReport${it.testObject.url}/history?start=${end+1}">${%Older}</a>
</j:if>
</div>
</l:main-panel>
...
...
core/src/main/resources/hudson/tasks/junit/Messages.properties
浏览文件 @
7a43fdfa
...
...
@@ -30,10 +30,12 @@ PackageResult.getChildTitle=Class
ClassResult.getTitle
=
Test Result : {0}
JUnitParser.DisplayName
=
JUnit Parser
JUnitParser.TestResultLocationMessage
=
JUnit xml files:
JUnitParser.no_workspace_found
=
No workspace found for {0}
JUnitResultArchiver.DisplayName
=
Publish JUnit test result report
JUnitResultArchiver.NoTestReportFound
=
No test report files were found. Configuration error?
JUnitResultArchiver.Recording
=
Recording test results
JUnitResultArchiver.ResultIsEmpty
=
None of the test reports contained any result
JUnitResultArchiver.BadXML
=
Incorrect XML attributes for test results found in {0}
JUnitResultArchiver.HealthScaleFactorAnalysis
=
{0}% failing tests scores as {1}% health. {2}% failing tests scores as {3}% health
CaseResult.Status.Passed
=
Passed
...
...
core/src/main/resources/hudson/tasks/junit/Messages_da.properties
浏览文件 @
7a43fdfa
...
...
@@ -32,6 +32,7 @@ TestResult.getTitle=Test Resultat
JUnitResultArchiver.DisplayName
=
Publicer JUnit testrapport
TestResult.getDisplayName
=
Testresultater
CaseResult.Status.Failed
=
Fejlet
JUnitResultArchiver.BadXML
=
Ukorrekt XML attribut fundet for test resultater i {0}
JUnitResultArchiver.ResultIsEmpty
=
Ingen af testrapporterne indeholder resultater
JUnitResultArchiver.NoTestReportFound
=
Ingen testrapporter fundet. Konfigurationsfejl?
PackageResult.getTitle
=
Testresultat : {0}
core/src/main/resources/hudson/tasks/junit/Messages_de.properties
浏览文件 @
7a43fdfa
...
...
@@ -39,3 +39,4 @@ CaseResult.Status.Skipped=Ausgelassen
CaseResult.Status.Fixed
=
Repariert
CaseResult.Status.Regression
=
Regression
JUnitResultArchiver.BadXML
=
Testergebnisse enthalten ungültige XML-Attribute in {0}
core/src/main/resources/hudson/tasks/junit/Messages_es.properties
浏览文件 @
7a43fdfa
...
...
@@ -32,6 +32,7 @@ JUnitResultArchiver.DisplayName=Publicar los resultadod de tests JUnit
JUnitResultArchiver.NoTestReportFound
=
No se encontraron ficheros con resultados de tests. ¿Hay algun error en la configuración?
JUnitResultArchiver.Recording
=
Grabando resultados de tests
JUnitResultArchiver.ResultIsEmpty
=
Ninguno de los informes de tests contiene resultados
JUnitResultArchiver.BadXML
=
Formato incorrecto en los atributos XML del fichero de resultados en {0}
CaseResult.Status.Passed
=
Pasados
CaseResult.Status.Failed
=
Fallidos
...
...
core/src/main/resources/hudson/tasks/junit/Messages_ja.properties
浏览文件 @
7a43fdfa
...
...
@@ -30,13 +30,15 @@ PackageResult.getChildTitle=\u30af\u30e9\u30b9
ClassResult.getTitle
=
\u
30c6
\u
30b9
\u
30c8
\u
7d50
\u
679c : {0}
JUnitParser.DisplayName
=
JUnit
\u
30d1
\u
30fc
\u
30b5
\u
30fc
JUnitParser.TestResultLocationMessage
=
JUnit
\u
306eXML
\u
30d5
\u
30a1
\u
30a4
\u
30eb :
JUnitParser.no_workspace_found
=
{0}
\u
306e
\u
30ef
\u
30fc
\u
30af
\u
30b9
\u
30da
\u
30fc
\u
30b9
\u
304c
\u
898b
\u3064\u
304b
\u
308a
\u
307e
\u
305b
\u3093\u3002
JUnitResultArchiver.DisplayName
=
JUnit
\u
30c6
\u
30b9
\u
30c8
\u
7d50
\u
679c
\u
306e
\u
96c6
\u
8a08
JUnitResultArchiver.NoTestReportFound
=
\u
30c6
\u
30b9
\u
30c8
\u
306e
\u
30ec
\u
30dd
\u
30fc
\u
30c8
\u
30d5
\u
30a1
\u
30a4
\u
30eb
\u
304c
\u
898b
\u3064\u
304b
\u
308a
\u
307e
\u
305b
\u3093\u3067\u3057\u
305f
\u3002\u
8a2d
\u
5b9a
\u
30df
\u
30b9?
JUnitResultArchiver.Recording
=
\u
30c6
\u
30b9
\u
30c8
\u
7d50
\u
679c
\u3092\u
4fdd
\u
5b58
\u
4e2d
JUnitResultArchiver.ResultIsEmpty
=
\u
30c6
\u
30b9
\u
30c8
\u
306e
\u
30ec
\u
30dd
\u
30fc
\u
30c8
\u
306b
\u
4f55
\u3082\u
7d50
\u
679c
\u
304c
\u
542b
\u
307e
\u
308c
\u3066\u3044\u
307e
\u
305b
\u3093
JUnitResultArchiver.BadXML
=
{0}
\u
306b
\u3001\u
30c6
\u
30b9
\u
30c8
\u
7d50
\u
679c
\u
306eXML
\u
306b
\u
4e0d
\u9069\u5207\u
306a
\u
5c5e
\u6027\u
304c
\u3042\u
308a
\u
307e
\u3059
CaseResult.Status.Passed
=
OK
CaseResult.Status.Failed
=
\u5931\u6557
CaseResult.Status.Skipped
=
\u
30b9
\u
30ad
\u
30c3
\u
30d7
CaseResult.Status.Fixed
=
\u
4fee
\u
6b63OK
CaseResult.Status.Regression
=
\u
30ea
\u
30b0
\u
30ec
\u
30c3
\u
30b7
\u
30e7
\u
30f3
CaseResult.Status.Regression
=
\u
30ea
\u
30b0
\u
30ec
\u
30c3
\u
30b7
\u
30e7
\u
30f3
\ No newline at end of file
core/src/main/resources/hudson/tasks/junit/Messages_pt_BR.properties
浏览文件 @
7a43fdfa
...
...
@@ -33,6 +33,7 @@ CaseResult.Status.Regression=Regress\u00e3o
# Recording test results
JUnitResultArchiver.Recording
=
Gravando o resultado dos testes
# Incorrect XML attributes for test results found in {0}
JUnitResultArchiver.BadXML
=
Atributos XML incorretos para teste de resultados em {0}
# Fixed
CaseResult.Status.Fixed
=
Fixo
# None of the test reports contained any result
...
...
core/src/main/resources/hudson/tasks/junit/Messages_zh_TW.properties
浏览文件 @
7a43fdfa
...
...
@@ -30,10 +30,12 @@ PackageResult.getChildTitle=\u985e\u5225
ClassResult.getTitle
=
\u
6e2c
\u
8a66
\u
7d50
\u
679c: {0}
JUnitParser.DisplayName
=
JUnit
\u5256\u6790\u
7a0b
\u
5f0f
JUnitParser.TestResultLocationMessage
=
JUnit XML
\u
6a94:
JUnitParser.no_workspace_found
=
\u
627e
\u
4e0d
\u5230
{0}
\u7684\u
5de5
\u
4f5c
\u5340
JUnitResultArchiver.DisplayName
=
\u
767c
\u
4f48 JUnit
\u
6e2c
\u
8a66
\u
7d50
\u
679c
\u5831\u
544a
JUnitResultArchiver.NoTestReportFound
=
\u
627e
\u
4e0d
\u5230\u
6e2c
\u
8a66
\u
7d50
\u
679c
\u5831\u
544a
\u3002\u
8a2d
\u
5b9a
\u
932f
\u
4e86
\u
55ce?
JUnitResultArchiver.Recording
=
\u
8a18
\u9304\u
6e2c
\u
8a66
\u
7d50
\u
679c
JUnitResultArchiver.ResultIsEmpty
=
\u
6e2c
\u
8a66
\u5831\u
544a
\u
4e2d
\u
90fd
\u
6c92
\u6709\u
7d50
\u
679c
JUnitResultArchiver.BadXML
=
\u5728
{0}
\u7684\u
6e2c
\u
8a66
\u
7d50
\u
679c
\u
4e2d
\u
767c
\u
73fe
\u
932f
\u
8aa4
\u7684
XML
\u
5c6c
\u6027
CaseResult.Status.Passed
=
\u
901a
\u
904e
CaseResult.Status.Failed
=
\u5931\u6557
...
...
core/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly
浏览文件 @
7a43fdfa
...
...
@@ -64,7 +64,7 @@ THE SOFTWARE.
<li class="${elementClass}" style="${elementStyle}">
<!-- child test results are referenced from their parent builds -->
<j:set var="build" value="${testObject.
run
}" />
<j:set var="build" value="${testObject.
owner
}" />
<a href="${it.getTestResultPath(testObject)}">
<st:out value="${testObject.fullDisplayName}" />
</a>
...
...
core/src/main/resources/hudson/tasks/test/MetaTabulatedResult/list.jelly
浏览文件 @
7a43fdfa
...
...
@@ -35,8 +35,8 @@ THE SOFTWARE.
<td class="pane-header" style="width:5em">${%Total}</td>
</tr>
<tbody>
<j:forEach var="b" items="${it.
run
.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultIn
Run
(b)}"/>
<j:forEach var="b" items="${it.
owner
.parent.builds}" begin="${start}" end="${end}">
<j:set var="p" value="${it.getResultIn
Build
(b)}"/>
<j:if test="${p != null}">
<tr>
<td class="pane">
...
...
core/src/main/resources/hudson/tasks/test/TestObject/sidepanel.jelly
浏览文件 @
7a43fdfa
...
...
@@ -32,16 +32,16 @@ THE SOFTWARE.
<l:tasks>
<j:set var="buildUrl" value="${h.decompose(request)}" />
<j:set var="baseUrl" value="${request.findAncestor(it).relativePath}"/>
<st:include it="${it.
run
}" page="tasks.jelly" optional="true"/>
<st:include it="${it.
owner
}" page="tasks.jelly" optional="true"/>
<l:task href="${baseUrl}/history" icon="icon-graph icon-md" title="${%History}"/>
<st:include it="${it.
run
}" page="actions.jelly" optional="true" />
<st:include it="${it.
owner
}" page="actions.jelly" optional="true" />
<t:actions actions="${it.testActions}" />
<j:if test="${it.
run
.previousBuild!=null}">
<j:if test="${it.
owner
.previousBuild!=null}">
<l:task href="${buildUrl.previousBuildUrl}" icon="icon-previous icon-md" title="${%Previous Build}"/>
</j:if>
<j:if test="${it.
run
.nextBuild!=null}">
<j:if test="${it.
owner
.nextBuild!=null}">
<l:task href="${buildUrl.nextBuildUrl}" icon="icon-next icon-md" title="${%Next Build}"/>
</j:if>
</l:tasks>
...
...
core/src/main/resources/hudson/tasks/test/TestResult/index.jelly
浏览文件 @
7a43fdfa
...
...
@@ -24,7 +24,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:test="/lib/test">
<l:layout title="${it.
run
} ${it.displayName}">
<l:layout title="${it.
owner
} ${it.displayName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1><st:out value="${it.title}" /></h1>
...
...
@@ -39,7 +39,7 @@ THE SOFTWARE.
</a>
</div>
<t:editableDescription permission="${it.
run
.UPDATE}"/>
<t:editableDescription permission="${it.
owner
.UPDATE}"/>
<table style="margin-top: 1em; margin-left:0em;">
<j:forEach var="action" items="${it.testActions}">
...
...
core/src/main/resources/hudson/tasks/test/TestResultProjectAction/index.jelly
浏览文件 @
7a43fdfa
...
...
@@ -25,11 +25,11 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:local="local">
<l:layout title="Test">
<st:include page="sidepanel.jelly" it="${it.
job
}" />
<st:include page="sidepanel.jelly" it="${it.
project
}" />
<l:main-panel>
<div>
<img src="trend?${request.queryString}" lazymap="trendMap?rel=../&${request.queryString}" alt="[Test result trend chart]"/>
</div>
</l:main-panel>
</l:layout>
</j:jelly>
</j:jelly>
\ No newline at end of file
core/src/main/resources/hudson/tasks/test/TestResultProjectAction/jobMain.jelly
浏览文件 @
7a43fdfa
...
...
@@ -26,7 +26,7 @@ THE SOFTWARE.
<?jelly escape-by-default='true'?>
<j:jelly
xmlns:j=
"jelly:core"
xmlns:st=
"jelly:stapler"
xmlns:t=
"/lib/hudson"
>
<table
style=
"margin-top: 1em; margin-left: 1em;"
>
<j:set
var=
"tr"
value=
"${it.
job
.lastCompletedBuild.getAction(it.class.classLoader.loadClass('hudson.tasks.test.AbstractTestResultAction'))}"
/>
<j:set
var=
"tr"
value=
"${it.
project
.lastCompletedBuild.getAction(it.class.classLoader.loadClass('hudson.tasks.test.AbstractTestResultAction'))}"
/>
<j:if
test=
"${tr != null}"
>
<t:summary
icon=
"clipboard.png"
>
<a
href=
"lastCompletedBuild/${tr.urlName}/"
>
${%Latest Test Result}
</a>
...
...
test/src/test/java/hudson/tasks/junit/JUnitParserTest.java
浏览文件 @
7a43fdfa
...
...
@@ -66,7 +66,7 @@ public class JUnitParserTest extends HudsonTestCase {
}
System
.
out
.
println
(
"...touched everything"
);
hudson
.
tasks
.
junit
.
TestResult
result
=
(
new
JUnitParser
()).
parse
Result
(
testResultLocation
,
build
,
build
.
getWorkspace
()
,
launcher
,
listener
);
hudson
.
tasks
.
junit
.
TestResult
result
=
(
new
JUnitParser
()).
parse
(
testResultLocation
,
build
,
launcher
,
listener
);
System
.
out
.
println
(
"back from parse"
);
assertNotNull
(
"we should have a non-null result"
,
result
);
...
...
test/src/test/java/hudson/tasks/test/TestResultExtensionTest.java
浏览文件 @
7a43fdfa
...
...
@@ -27,7 +27,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import
hudson.model.FreeStyleBuild
;
import
hudson.model.FreeStyleProject
;
import
hudson.model.Result
;
import
hudson.model.
Run
;
import
hudson.model.
AbstractBuild
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.jvnet.hudson.test.TouchBuilder
;
...
...
@@ -50,13 +50,13 @@ public class TestResultExtensionTest extends HudsonTestCase {
assertBuildStatus
(
Result
.
SUCCESS
,
build
);
TrivialTestResultAction
action
=
build
.
getAction
(
TrivialTestResultAction
.
class
);
assertNotNull
(
"we should have an action"
,
action
);
assertNotNull
(
"parent action should have an owner"
,
action
.
run
);
assertNotNull
(
"parent action should have an owner"
,
action
.
owner
);
Object
resultObject
=
action
.
getResult
();
assertNotNull
(
"we should have a result"
);
assertTrue
(
"result should be an TestResult"
,
resultObject
instanceof
TestResult
);
TestResult
result
=
(
TestResult
)
resultObject
;
Run
<?,?>
ownerBuild
=
result
.
getRun
();
AbstractBuild
<?,?>
ownerBuild
=
result
.
getOwner
();
assertNotNull
(
"we should have an owner"
,
ownerBuild
);
assertNotNull
(
"we should have a list of test actions"
,
result
.
getTestActions
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录