本文整理汇总了Java中hudson.tasks.test.TestResult类的典型用法代码示例。如果您正苦于以下问题:Java TestResult类的具体用法?Java TestResult怎么用?Java TestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestResult类属于hudson.tasks.test包,在下文中一共展示了TestResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例14: findCorrespondingResult
import hudson.tasks.test.TestResult; //导入依赖的package包/类
@Override
public TestResult findCorrespondingResult(String id) {
if (getId().equals(id) || (id == null))
return this;
return null;
}
示例15: singletonListOfThisOrEmptyList
import hudson.tasks.test.TestResult; //导入依赖的package包/类
private Collection<? extends TestResult> singletonListOfThisOrEmptyList(boolean f) {
if (f)
return singletonList(this);
else
return emptyList();
}