本文整理汇总了Java中hudson.tasks.test.TestResult类的典型用法代码示例。如果您正苦于以下问题:Java TestResult类的具体用法?Java TestResult怎么用?Java TestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestResult类属于hudson.tasks.test包,在下文中一共展示了TestResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Returns the AWS Device Farm test result for the given id. The id will likely be the default
* value generated by Jenkins, which is usually just the human readable name. Return this
* test result the ID's match, otherwise scan our previous runs looking for a matching result.
* If no match is found, return null.
*
* @param id
* @return
*/
public TestResult findCorrespondingResult(String id) {
if (id == null || getId().equalsIgnoreCase(id)) {
return this;
}
ArrayList<AWSDeviceFarmTestResultAction> prevActions = AWSDeviceFarmUtils.previousAWSDeviceFarmBuilds(build.getProject());
if (prevActions == null || prevActions.isEmpty()) {
return null;
}
for (AWSDeviceFarmTestResultAction action : prevActions) {
AWSDeviceFarmTestResult prevResult = action.getResult();
if (prevResult == null) {
continue;
}
if (prevResult.getId().equalsIgnoreCase(id)) {
return prevResult;
}
}
return null;
}
开发者ID:awslabs,项目名称:aws-device-farm-jenkins-plugin,代码行数:29,代码来源:AWSDeviceFarmTestResult.java
示例2: findCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
@Override
public hudson.tasks.test.TestResult findCorrespondingResult(String id) {
String myID = safe(getName());
String caseName = id;
int base = id.indexOf(myID);
if (base > 0) {
int caseNameStart = base + myID.length() + 1;
if (id.length() > caseNameStart) {
caseName = id.substring(caseNameStart);
}
}
FlakyCaseResult child = getCaseResult(caseName);
if (child != null) {
return child;
}
return null;
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:18,代码来源:FlakyClassResult.java
示例3: findCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Returns the AppThwack test result for the given id. The id will likely be the default
* value generated by Jenkins, which is usually just the human readable name. Return this
* test result the ID's match, otherwise scan our previous runs looking for a matching result.
* If no match is found, return null.
* @param id
* @return
*/
public TestResult findCorrespondingResult(String id) {
if (id == null || getId().equalsIgnoreCase(id)) {
return this;
}
ArrayList<AppThwackTestResultAction> prevActions = AppThwackUtils.previousAppThwackBuilds(build.getProject());
if (prevActions == null || prevActions.isEmpty()) {
return null;
}
for (AppThwackTestResultAction action : prevActions) {
AppThwackTestResult prevResult = action.getResult();
if (prevResult == null) {
continue;
}
if (prevResult.getId().equalsIgnoreCase(id)) {
return prevResult;
}
}
return null;
}
开发者ID:jenkinsci,项目名称:appthwack-plugin,代码行数:28,代码来源:AppThwackTestResult.java
示例4: appendTestSummary
import hudson.tasks.test.TestResult; //导入依赖的package包/类
public MessageBuilder appendTestSummary(boolean includeFailedTests) {
AbstractTestResultAction<?> action = this.build
.getAction(AbstractTestResultAction.class);
if (action != null) {
int total = action.getTotalCount();
int failed = action.getFailCount();
int skipped = action.getSkipCount();
message.append("\n");
message.append("<b>Test Status:</b>\n");
message.append("Passed: " + (total - failed - skipped));
message.append(", Failed: " + failed);
message.append(", Skipped: " + skipped);
if(includeFailedTests && failed > 0){
message.append("\n<b>Failed Tests:</b>\n");
List<? extends TestResult> failedTests = action.getFailedTests();
for(int i = 0; i<failedTests.size();i++){
TestResult result = failedTests.get(i);
String testName = result.getName();
if(testName.length() > 60) {
String[] splittedTestName = testName.split("\\.");
testName = "";
for(int j = splittedTestName.length - 1;j>=0;j--){
if(testName.length() + splittedTestName[j].length() + 1 > 60) break;
testName = splittedTestName[j] + "." + testName;
}
testName = testName.substring(0,testName.length()-1);
}
message.append(escape(testName + "\n"));
}
}
} else {
message.append("\nNo Tests found.");
}
return this;
}
开发者ID:FluffyFairyGames,项目名称:jenkins-telegram-plugin,代码行数:37,代码来源:ActiveNotifier.java
示例5: evaluate
import hudson.tasks.test.TestResult; //导入依赖的package包/类
@Override
public String evaluate(AbstractBuild<?, ?> build, TaskListener listener, String macroName) throws MacroEvaluationException, IOException, InterruptedException {
AbstractTestResultAction<?> testResultContainer = build.getAction(AbstractTestResultAction.class);
StringBuilder testResult = new StringBuilder();
if (testResultContainer != null) {
String testResultDescription = testResultContainer.getBuildHealth().getDescription();
testResult.append(testResultDescription);
Integer failedUnitTests = testResultContainer.getFailedTests().size();
if (failedUnitTests > 0) {
testResult.append("\nFailures:");
Integer processedUnitTests = 0;
for (TestResult testResultItem : testResultContainer.getFailedTests()) {
testResult.append(Constants.LINE_SEPARATOR).append("\n").append(testResultItem.getFullName());
if ((null != testResultItem.getErrorDetails()) && !testResultItem.getErrorDetails().trim().isEmpty()) {
testResult.append("\n-------- Message --------\n").append(testResultItem.getErrorDetails().trim());
}
if ((null != testResultItem.getStderr()) && !testResultItem.getStderr().trim().isEmpty()) {
testResult.append("\n-------- Stacktrace --------\n").append(testResultItem.getStderr().trim());
}
processedUnitTests++;
if (processedUnitTests.equals(failedUnitTests)) {
testResult.append(Constants.LINE_SEPARATOR);
}
}
}
}
return testResult.toString();
}
开发者ID:fundacionjala,项目名称:enforce-jenkins-plugin,代码行数:29,代码来源:EnforceTestResultTokenMacro.java
示例6: findCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Case results have no children
* @return null
*/
@Override
public TestResult findCorrespondingResult(String id) {
if (id.equals(safe(getName()))) {
return this;
}
return null;
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:12,代码来源:FlakyCaseResult.java
示例7: findCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
@Override
public TestResult findCorrespondingResult(String id) {
String myID = safe(getName());
int base = id.indexOf(myID);
String className = id; // fall back value
if (base > 0) {
int classNameStart = base + myID.length() + 1;
if (classNameStart<id.length())
className = id.substring(classNameStart);
}
String subId = null;
int classNameEnd = className.indexOf('/');
if (classNameEnd > 0) {
subId = className.substring(classNameEnd + 1);
if (subId.length() == 0) {
subId = null;
}
className = className.substring(0, classNameEnd);
}
FlakyClassResult child = getClassResult(className);
if (child != null && subId != null)
return child.findCorrespondingResult(subId);
return child;
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:29,代码来源:FlakyPackageResult.java
示例8: getPassedTests
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Gets the "children" of this test result that passed without a flake
*
* @return the children of this test result, if any, or an empty collection
*/
@Override
public Collection<? extends hudson.tasks.test.TestResult> getPassedTests() {
List<FlakyCaseResult> r = new ArrayList<FlakyCaseResult>();
for (FlakyClassResult clr : classes.values()) {
for (FlakyCaseResult cr : clr.getChildren()) {
if (cr.isPassed() && !cr.isFlaked()) {
r.add(cr);
}
}
}
return r;
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:18,代码来源:FlakyPackageResult.java
示例9: getSkippedTests
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Gets the "children" of this test result that were skipped
*
* @return the children of this test result, if any, or an empty list
*/
@Override
public Collection<? extends TestResult> getSkippedTests() {
List<FlakyCaseResult> r = new ArrayList<FlakyCaseResult>();
for (FlakyClassResult clr : classes.values()) {
for (FlakyCaseResult cr : clr.getChildren()) {
if (cr.isSkipped()) {
r.add(cr);
}
}
}
return r;
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:18,代码来源:FlakyPackageResult.java
示例10: getPreviousResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
@Override
public FlakyClassResult getPreviousResult() {
if (parent == null) {
return null;
}
TestResult pr = parent.getPreviousResult();
if (pr == null) {
return null;
}
if (pr instanceof FlakyPackageResult) {
return ((FlakyPackageResult) pr).getClassResult(getName());
}
return null;
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:15,代码来源:FlakyClassResult.java
示例11: testFindCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
public void testFindCorrespondingResult() {
FlakyClassResult flakyClassResult = new FlakyClassResult(null, "com.example.ExampleTest");
FlakyCaseResult flakyCaseResult = new FlakyCaseResult(null, "testCase", null);
flakyClassResult.add(flakyCaseResult);
TestResult result = flakyClassResult
.findCorrespondingResult("extraprefix.com.example.ExampleTest.testCase");
assertEquals(flakyCaseResult, result);
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:12,代码来源:FlakyClassResultTest.java
示例12: mockTestObject
import hudson.tasks.test.TestResult; //导入依赖的package包/类
private TestObject mockTestObject(String testName, boolean pass, String url) {
TestObject testObject = mock(TestResult.class, testName);
when(testObject.getFailCount()).thenReturn(pass ? 0 : 100);
when(testObject.getName()).thenReturn(testName);
when(testObject.getUrl()).thenReturn(url);
return testObject;
}
开发者ID:daveneedstoknow,项目名称:RadTest,代码行数:8,代码来源:JobResultsTest.java
示例13: getNumberOfSuccessivePasses
import hudson.tasks.test.TestResult; //导入依赖的package包/类
public int getNumberOfSuccessivePasses(CaseResult test) {
int count = 0;
for (TestResult result : test.getHistory().getList()) {
if (result.isPassed()) {
count++;
} else {
return count;
}
}
return count;
}
开发者ID:samsta,项目名称:quarantine,代码行数:13,代码来源:QuarantinedTestsReport.java
示例14: findCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
@Override
public TestResult findCorrespondingResult(String id) {
if (getId().equals(id) || (id == null))
return this;
return null;
}
开发者ID:pescuma,项目名称:buildhealth,代码行数:8,代码来源:UnitTestResult.java
示例15: singletonListOfThisOrEmptyList
import hudson.tasks.test.TestResult; //导入依赖的package包/类
private Collection<? extends TestResult> singletonListOfThisOrEmptyList(boolean f) {
if (f)
return singletonList(this);
else
return emptyList();
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:7,代码来源:FlakyCaseResult.java
示例16: testFindCorrespondingResultWhereFlakyClassResultNameIsNotSubstring
import hudson.tasks.test.TestResult; //导入依赖的package包/类
public void testFindCorrespondingResultWhereFlakyClassResultNameIsNotSubstring() {
FlakyClassResult FlakyClassResult = new FlakyClassResult(null, "aaaa");
FlakyCaseResult FlakyCaseResult = new FlakyCaseResult(null, "tc_bbbb", null);
FlakyClassResult.add(FlakyCaseResult);
TestResult result = FlakyClassResult.findCorrespondingResult("tc_bbbb");
assertEquals(FlakyCaseResult, result);
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:11,代码来源:FlakyClassResultTest.java
示例17: testFindCorrespondingResultWhereFlakyClassResultNameIsLastInFlakyCaseResultName
import hudson.tasks.test.TestResult; //导入依赖的package包/类
public void testFindCorrespondingResultWhereFlakyClassResultNameIsLastInFlakyCaseResultName() {
FlakyClassResult FlakyClassResult = new FlakyClassResult(null, "aaaa");
FlakyCaseResult FlakyCaseResult = new FlakyCaseResult(null, "tc_aaaa", null);
FlakyClassResult.add(FlakyCaseResult);
TestResult result = FlakyClassResult.findCorrespondingResult("tc_aaaa");
assertEquals(FlakyCaseResult, result);
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:11,代码来源:FlakyClassResultTest.java
示例18: getFailedTests
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Gets the "children" of this test result that failed
*
* @return the children of this test result, if any, or an empty collection
*/
@Override
public Collection<? extends TestResult> getFailedTests() {
return singletonListOfThisOrEmptyList(isFailed());
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:10,代码来源:FlakyCaseResult.java
示例19: getPassedTests
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Gets the "children" of this test result that passed
*
* @return the children of this test result, if any, or an empty collection
*/
@Override
public Collection<? extends TestResult> getPassedTests() {
return singletonListOfThisOrEmptyList(isPassed());
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:10,代码来源:FlakyCaseResult.java
示例20: getSkippedTests
import hudson.tasks.test.TestResult; //导入依赖的package包/类
/**
* Gets the "children" of this test result that were skipped
*
* @return the children of this test result, if any, or an empty list
*/
@Override
public Collection<? extends TestResult> getSkippedTests() {
return singletonListOfThisOrEmptyList(isSkipped());
}
开发者ID:jenkinsci,项目名称:flaky-test-handler-plugin,代码行数:10,代码来源:FlakyCaseResult.java
注:本文中的hudson.tasks.test.TestResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论