Java Code Examples for org.gradle.api.tasks.testing.TestResult#ResultType

The following examples show how to use org.gradle.api.tasks.testing.TestResult#ResultType . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GradleTestSuiteCollector.java    From gradle-metrics-plugin with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
Result getTestResult(TestResult testResult) {
    TestResult.ResultType testResultType = testResult.getResultType();
    List<Throwable> exceptions = testResult.getExceptions();
    Result result;
    switch (testResultType) {
        case SUCCESS:
            result = Result.success();
            break;
        case SKIPPED:
            result = Result.skipped();
            break;
        case FAILURE:
            //noinspection ConstantConditions
            result = Result.failure(exceptions);
            break;
        default:
            logger.warn("Test result carried unknown result type '{}'. Assuming success", testResultType);
            result = Result.success();
    }
    return result;
}
 
Example 2
Source File: TestResultSerializer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestMethodResult readMethodResult(Decoder decoder) throws ClassNotFoundException, IOException {
    long id = decoder.readSmallLong();
    String name = decoder.readString();
    TestResult.ResultType resultType = TestResult.ResultType.values()[decoder.readSmallInt()];
    long duration = decoder.readSmallLong();
    long endTime = decoder.readLong();
    TestMethodResult methodResult = new TestMethodResult(id, name, resultType, duration, endTime);
    int failures = decoder.readSmallInt();
    for (int i = 0; i < failures; i++) {
        String exceptionType = decoder.readString();
        String message = decoder.readString();
        String stackTrace = decoder.readString();
        methodResult.addFailure(message, stackTrace, exceptionType);
    }
    return methodResult;
}
 
Example 3
Source File: TestResultSerializer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestMethodResult readMethodResult(Decoder decoder) throws ClassNotFoundException, IOException {
    long id = decoder.readSmallLong();
    String name = decoder.readString();
    TestResult.ResultType resultType = TestResult.ResultType.values()[decoder.readSmallInt()];
    long duration = decoder.readSmallLong();
    long endTime = decoder.readLong();
    TestMethodResult methodResult = new TestMethodResult(id, name, resultType, duration, endTime);
    int failures = decoder.readSmallInt();
    for (int i = 0; i < failures; i++) {
        String exceptionType = decoder.readString();
        String message = decoder.readString();
        String stackTrace = decoder.readString();
        methodResult.addFailure(message, stackTrace, exceptionType);
    }
    return methodResult;
}
 
Example 4
Source File: TestResultSerializer.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestMethodResult readMethodResult(Decoder decoder) throws ClassNotFoundException, IOException {
    long id = decoder.readSmallLong();
    String name = decoder.readString();
    TestResult.ResultType resultType = TestResult.ResultType.values()[decoder.readSmallInt()];
    long duration = decoder.readSmallLong();
    long endTime = decoder.readLong();
    TestMethodResult methodResult = new TestMethodResult(id, name, resultType, duration, endTime);
    int failures = decoder.readSmallInt();
    for (int i = 0; i < failures; i++) {
        String exceptionType = decoder.readString();
        String message = decoder.readString();
        String stackTrace = decoder.readString();
        methodResult.addFailure(message, stackTrace, exceptionType);
    }
    return methodResult;
}
 
Example 5
Source File: TestNGTestResultProcessorAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void onTestFinished(ITestResult iTestResult, TestResult.ResultType resultType) {
    Object testId;
    TestStartEvent startEvent = null;
    synchronized (lock) {
        testId = tests.remove(iTestResult);
        if (testId == null) {
            // This can happen when a method fails which this method depends on 
            testId = idGenerator.generateId();
            Object parentId = testMethodToSuiteMapping.get(iTestResult.getMethod());
            startEvent = new TestStartEvent(iTestResult.getStartMillis(), parentId);
        }
    }
    if (startEvent != null) {
        // Synthesize a start event
        resultProcessor.started(new DefaultTestMethodDescriptor(testId, iTestResult.getTestClass().getName(), iTestResult.getName()), startEvent);
    }
    if (resultType == TestResult.ResultType.FAILURE) {
        resultProcessor.failure(testId, iTestResult.getThrowable());
    }
    resultProcessor.completed(testId, new TestCompleteEvent(iTestResult.getEndMillis(), resultType));
}
 
Example 6
Source File: TestNGTestResultProcessorAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void onTestFinished(ITestResult iTestResult, TestResult.ResultType resultType) {
    Object testId;
    TestStartEvent startEvent = null;
    synchronized (lock) {
        testId = tests.remove(iTestResult);
        if (testId == null) {
            // This can happen when a method fails which this method depends on 
            testId = idGenerator.generateId();
            Object parentId = testMethodToSuiteMapping.get(iTestResult.getMethod());
            startEvent = new TestStartEvent(iTestResult.getStartMillis(), parentId);
        }
    }
    if (startEvent != null) {
        // Synthesize a start event
        resultProcessor.started(new DefaultTestMethodDescriptor(testId, iTestResult.getTestClass().getName(), iTestResult.getName()), startEvent);
    }
    if (resultType == TestResult.ResultType.FAILURE) {
        resultProcessor.failure(testId, iTestResult.getThrowable());
    }
    resultProcessor.completed(testId, new TestCompleteEvent(iTestResult.getEndMillis(), resultType));
}
 
Example 7
Source File: TestResultSerializer.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private TestMethodResult readMethodResult(Decoder decoder) throws ClassNotFoundException, IOException {
    long id = decoder.readSmallLong();
    String name = decoder.readString();
    TestResult.ResultType resultType = TestResult.ResultType.values()[decoder.readSmallInt()];
    long duration = decoder.readSmallLong();
    long endTime = decoder.readLong();
    TestMethodResult methodResult = new TestMethodResult(id, name, resultType, duration, endTime);
    int failures = decoder.readSmallInt();
    for (int i = 0; i < failures; i++) {
        String exceptionType = decoder.readString();
        String message = decoder.readString();
        String stackTrace = decoder.readString();
        methodResult.addFailure(message, stackTrace, exceptionType);
    }
    return methodResult;
}
 
Example 8
Source File: TestNGTestResultProcessorAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void onTestFinished(ITestResult iTestResult, TestResult.ResultType resultType) {
    Object testId;
    TestStartEvent startEvent = null;
    synchronized (lock) {
        testId = tests.remove(iTestResult);
        if (testId == null) {
            // This can happen when a method fails which this method depends on 
            testId = idGenerator.generateId();
            Object parentId = testMethodToSuiteMapping.get(iTestResult.getMethod());
            startEvent = new TestStartEvent(iTestResult.getStartMillis(), parentId);
        }
    }
    if (startEvent != null) {
        // Synthesize a start event
        resultProcessor.started(new DefaultTestMethodDescriptor(testId, iTestResult.getTestClass().getName(), iTestResult.getName()), startEvent);
    }
    if (resultType == TestResult.ResultType.FAILURE) {
        resultProcessor.failure(testId, iTestResult.getThrowable());
    }
    resultProcessor.completed(testId, new TestCompleteEvent(iTestResult.getEndMillis(), resultType));
}
 
Example 9
Source File: TestMethodResult.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestMethodResult(long id, String name, TestResult.ResultType resultType, long duration, long endTime) {
    if (id < 1) {
        throw new IllegalArgumentException("id must be > 0");
    }
    this.id = id;
    this.name = name;
    this.resultType = resultType;
    this.duration = duration;
    this.endTime = endTime;
}
 
Example 10
Source File: TestMethodResult.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestMethodResult(long id, String name, TestResult.ResultType resultType, long duration, long endTime) {
    if (id < 1) {
        throw new IllegalArgumentException("id must be > 0");
    }
    this.id = id;
    this.name = name;
    this.resultType = resultType;
    this.duration = duration;
    this.endTime = endTime;
}
 
Example 11
Source File: TestMethodResult.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestMethodResult(long id, String name, TestResult.ResultType resultType, long duration, long endTime) {
    if (id < 1) {
        throw new IllegalArgumentException("id must be > 0");
    }
    this.id = id;
    this.name = name;
    this.resultType = resultType;
    this.duration = duration;
    this.endTime = endTime;
}
 
Example 12
Source File: TestMethodResult.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestMethodResult(long id, String name, TestResult.ResultType resultType, long duration, long endTime) {
    if (id < 1) {
        throw new IllegalArgumentException("id must be > 0");
    }
    this.id = id;
    this.name = name;
    this.resultType = resultType;
    this.duration = duration;
    this.endTime = endTime;
}
 
Example 13
Source File: TestCompleteEvent.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TestCompleteEvent(long endTime, TestResult.ResultType resultType) {
    this.endTime = endTime;
    this.resultType = resultType;
}
 
Example 14
Source File: TestCompleteEvent.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TestCompleteEvent(long endTime, TestResult.ResultType resultType) {
    this.endTime = endTime;
    this.resultType = resultType;
}
 
Example 15
Source File: TestCompleteEvent.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TestCompleteEvent(long endTime, TestResult.ResultType resultType) {
    this.endTime = endTime;
    this.resultType = resultType;
}
 
Example 16
Source File: TestCompleteEvent.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
public TestResult.ResultType getResultType() {
    return resultType;
}
 
Example 17
Source File: TestCompleteEvent.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
public TestResult.ResultType getResultType() {
    return resultType;
}
 
Example 18
Source File: TestEventSerializer.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public TestCompleteEvent read(Decoder decoder) throws Exception {
    long endTime = decoder.readLong();
    TestResult.ResultType result = typeSerializer.read(decoder);
    return new TestCompleteEvent(endTime, result);
}
 
Example 19
Source File: TestResultModel.java    From Pushjet-Android with BSD 2-Clause "Simplified" License votes vote down vote up
public abstract TestResult.ResultType getResultType(); 
Example 20
Source File: TestResultModel.java    From Pushjet-Android with BSD 2-Clause "Simplified" License votes vote down vote up
public abstract TestResult.ResultType getResultType();