Java 类org.gradle.api.tasks.testing.TestResult 实例源码

项目:Reer    文件:TestNGTestResultProcessorAdapter.java   
private void onTestFinished(ITestResult iTestResult, TestResult.ResultType resultType) {
    Object testId;
    TestStartEvent startEvent = null;
    synchronized (lock) {
        testId = testMethodId.remove(iTestResult);
        if (testId == null) {
            // This can happen when a method fails which this method depends on
            testId = idGenerator.generateId();
            Object parentId = testMethodParentId.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));
}
项目:Reer    文件:TestResultSerializer.java   
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;
}
项目:Pushjet-Android    文件:TestNGTestResultProcessorAdapter.java   
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));
}
项目:Pushjet-Android    文件:TestResultSerializer.java   
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;
}
项目:Pushjet-Android    文件:TestNGTestResultProcessorAdapter.java   
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));
}
项目:Pushjet-Android    文件:TestResultSerializer.java   
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;
}
项目:gradle-metrics-plugin    文件:GradleTestSuiteCollector.java   
@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;
}
项目:Reer    文件:TestEventLogger.java   
private void after(TestDescriptor descriptor, TestResult result) {
    TestLogEvent event = getEvent(result);

    if (shouldLogEvent(descriptor, event)) {
        String details = shouldLogExceptions(result) ? exceptionFormatter.format(descriptor, result.getExceptions()) : null;
        logEvent(descriptor, event, details);
    }
}
项目:Reer    文件:TestEventLogger.java   
private TestLogEvent getEvent(TestResult result) {
    switch (result.getResultType()) {
        case SUCCESS: return TestLogEvent.PASSED;
        case FAILURE: return TestLogEvent.FAILED;
        case SKIPPED: return TestLogEvent.SKIPPED;
        default: throw new AssertionError();
    }
}
项目:Reer    文件:TestCountLogger.java   
@Override
public void afterTest(TestDescriptor testDescriptor, TestResult result) {
    totalTests += result.getTestCount();
    failedTests += result.getFailedTestCount();
    skippedTests += result.getSkippedTestCount();
    progressLogger.progress(summary());
}
项目:Reer    文件:TestCountLogger.java   
@Override
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null) {
        if (failedTests > 0) {
            logger.error(TextUtil.getPlatformLineSeparator() + summary());
        }
        progressLogger.completed();

        if (result.getResultType() == TestResult.ResultType.FAILURE) {
            hadFailures = true;
        }
    }
}
项目:Reer    文件:TestListenerAdapter.java   
@Override
public void completed(TestDescriptorInternal test, TestResult result, TestCompleteEvent completeEvent) {
    if (test.isComposite()) {
        testListener.afterSuite(test, result);
    } else {
        testListener.afterTest(test, result);
    }
}
项目:Reer    文件:TestState.java   
public void completed(TestCompleteEvent event) {
    this.completeEvent = event;
    resultType = isFailed() ? TestResult.ResultType.FAILURE
            : event.getResultType() != null ? event.getResultType() : TestResult.ResultType.SUCCESS;

    if (!test.isComposite()) {
        testCount = 1;
        switch (resultType) {
            case SUCCESS:
                successfulCount = 1;
                break;
            case FAILURE:
                failedCount = 1;
                break;
        }
    }

    if (startEvent.getParentId() != null) {
        TestState parentState = executing.get(startEvent.getParentId());
        if (parentState != null) {
            if (isFailed()) {
                parentState.failedChild = true;
            }
            parentState.testCount += testCount;
            parentState.successfulCount += successfulCount;
            parentState.failedCount += failedCount;
        }
    }
}
项目:Reer    文件:ClientForwardingTestListener.java   
private static AbstractTestResult adapt(TestResult result) {
    TestResult.ResultType resultType = result.getResultType();
    switch (resultType) {
        case SUCCESS:
            return new DefaultTestSuccessResult(result.getStartTime(), result.getEndTime());
        case SKIPPED:
            return new DefaultTestSkippedResult(result.getStartTime(), result.getEndTime());
        case FAILURE:
            return new DefaultTestFailureResult(result.getStartTime(), result.getEndTime(), convertExceptions(result.getExceptions()));
        default:
            throw new IllegalStateException("Unknown test result type: " + resultType);
    }
}
项目:Reer    文件:TestExecutionResultEvaluator.java   
@Override
public void completed(TestDescriptorInternal testDescriptor, TestResult testResult, TestCompleteEvent completeEvent) {
    if (testDescriptor.getParent() == null) {
        resultCount = resultCount + testResult.getTestCount();
    }
    if (!testDescriptor.isComposite() && testResult.getFailedTestCount() != 0) {
        failedTests.add(new FailedTest(testDescriptor.getName(), testDescriptor.getClassName(), getTaskPath(testDescriptor)));
    }
}
项目:Reer    文件:TestNGTestResultProcessorAdapter.java   
@Override
public void onConfigurationFailure(ITestResult testResult) {
    synchronized (lock) {
        if (!failedConfigurations.add(testResult)) {
            // workaround for bug in TestNG 6.2 (apparently fixed in some 6.3.x): listener is notified twice per event
            return;
        }
    }
    // Synthesise a test for the broken configuration method
    TestDescriptorInternal test = new DefaultTestMethodDescriptor(idGenerator.generateId(),
            testResult.getMethod().getTestClass().getName(), testResult.getMethod().getMethodName());
    resultProcessor.started(test, new TestStartEvent(testResult.getStartMillis()));
    resultProcessor.failure(test.getId(), testResult.getThrowable());
    resultProcessor.completed(test.getId(), new TestCompleteEvent(testResult.getEndMillis(), TestResult.ResultType.FAILURE));
}
项目:Reer    文件:TestClassResult.java   
public TestClassResult add(TestMethodResult methodResult) {
    if (methodResult.getResultType() == TestResult.ResultType.FAILURE) {
        failuresCount++;
    }
    if(methodResult.getResultType() == TestResult.ResultType.SKIPPED) {
        skippedCount++;
    }
    methodResults.add(methodResult);
    return this;
}
项目:Reer    文件:JUnitXmlResultWriter.java   
private void writeTests(SimpleXmlWriter writer, Iterable<TestMethodResult> methodResults, String className, long classId) throws IOException {
    for (TestMethodResult methodResult : methodResults) {
        writer.startElement("testcase")
                .attribute("name", methodResult.getName())
                .attribute("classname", className)
                .attribute("time", String.valueOf(methodResult.getDuration() / 1000.0));

        if (methodResult.getResultType() == TestResult.ResultType.SKIPPED) {
            writer.startElement("skipped");
            writer.endElement();
        } else {
            for (TestFailure failure : methodResult.getFailures()) {
                writer.startElement("failure")
                        .attribute("message", failure.getMessage())
                        .attribute("type", failure.getExceptionType());

                writer.characters(failure.getStackTrace());

                writer.endElement();
            }
        }

        if (outputAssociation.equals(TestOutputAssociation.WITH_TESTCASE)) {
            writer.startElement("system-out");
            writeOutputs(writer, classId, methodResult.getId(), TestOutputEvent.Destination.StdOut);
            writer.endElement();
            writer.startElement("system-err");
            writeOutputs(writer, classId, methodResult.getId(), TestOutputEvent.Destination.StdErr);
            writer.endElement();
        }

        writer.endElement();
    }
}
项目:Reer    文件:TestMethodResult.java   
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;
}
项目:Reer    文件:JUnitTestEventAdapter.java   
@Override
public void testIgnored(Description description) throws Exception {
    if (methodName(description) == null) {
        // An @Ignored class, ignore the event. We don't get testIgnored events for each method, so we have
        // generate them on our own
        processIgnoredClass(description);
        return;
    }

    TestDescriptorInternal testInternal = descriptor(idGenerator.generateId(), description);
    resultProcessor.started(testInternal, startEvent());
    resultProcessor.completed(testInternal.getId(), new TestCompleteEvent(timeProvider.getCurrentTime(), TestResult.ResultType.SKIPPED));
}
项目:jovial    文件:JovialTestExecuter.java   
private void handleEvent(Map<String, Object> event) {
    // Gradle seems to only allow two tiers of tests, so drop the roots
    if (event.get("parentId") == null) {
        return;
    }

    JovialTestDescriptor descriptor = descriptors.computeIfAbsent((String) event.get("uniqueId"), uniqueId -> {
        boolean container = (boolean) event.get("container");
        JovialTestDescriptor parent = container ? null : descriptors.get((String) event.get("parentId"));
        return new JovialTestDescriptor(uniqueId, parent, (String) event.get("displayName"), container);
    });

    switch ((String) event.get("type")) {
        case "dynamicTestRegistered":
            // do nothing, for now
            break;
        case "executionSkipped":
            testResultProcessor.completed(descriptor.getId(), new TestCompleteEvent(Instant.now().toEpochMilli(), TestResult.ResultType.SKIPPED));
            break;
        case "executionStarted":
            testResultProcessor.started(descriptor, new TestStartEvent(Instant.now().toEpochMilli(), null));
            break;
        case "executionFinished":
            boolean success = (boolean) event.get("success");
            TestResult.ResultType result = success ? TestResult.ResultType.SUCCESS : TestResult.ResultType.FAILURE;
            Throwable cause = (Throwable) event.get("throwable");
            if (cause != null) {
                testResultProcessor.failure(descriptor.getId(), cause);
            }
            testResultProcessor.completed(descriptor.getId(), new TestCompleteEvent(Instant.now().toEpochMilli(), result));
            break;
    }
}
项目:Pushjet-Android    文件:TestNGTestResultProcessorAdapter.java   
public void onConfigurationFailure(ITestResult testResult) {
    if (failedConfigurations.put(testResult, true) != null) {
        // workaround for bug in TestNG 6.2 (apparently fixed in some 6.3.x): listener is notified twice per event
        return;
    }
    // Synthesise a test for the broken configuration method
    TestDescriptorInternal test = new DefaultTestMethodDescriptor(idGenerator.generateId(),
            testResult.getMethod().getTestClass().getName(), testResult.getMethod().getMethodName());
    resultProcessor.started(test, new TestStartEvent(testResult.getStartMillis()));
    resultProcessor.failure(test.getId(), testResult.getThrowable());
    resultProcessor.completed(test.getId(), new TestCompleteEvent(testResult.getEndMillis(), TestResult.ResultType.FAILURE));
}
项目:Pushjet-Android    文件:TestClassResult.java   
public TestClassResult add(TestMethodResult methodResult) {
    if (methodResult.getResultType() == TestResult.ResultType.FAILURE) {
        failuresCount++;
    }
    if(methodResult.getResultType() == TestResult.ResultType.SKIPPED) {
        skippedCount++;
    }
    methodResults.add(methodResult);
    return this;
}
项目:Pushjet-Android    文件:JUnitXmlResultWriter.java   
private void writeTests(SimpleXmlWriter writer, Iterable<TestMethodResult> methodResults, String className, long classId) throws IOException {
    for (TestMethodResult methodResult : methodResults) {
        writer.startElement("testcase")
                .attribute("name", methodResult.getName())
                .attribute("classname", className)
                .attribute("time", String.valueOf(methodResult.getDuration() / 1000.0));

        if (methodResult.getResultType() == TestResult.ResultType.SKIPPED) {
            writer.startElement("skipped");
            writer.endElement();
        } else {
            for (TestFailure failure : methodResult.getFailures()) {
                writer.startElement("failure")
                        .attribute("message", failure.getMessage())
                        .attribute("type", failure.getExceptionType());

                writer.characters(failure.getStackTrace());

                writer.endElement();
            }
        }

        if (outputAssociation.equals(TestOutputAssociation.WITH_TESTCASE)) {
            writer.startElement("system-out");
            writeOutputs(writer, classId, methodResult.getId(), TestOutputEvent.Destination.StdOut);
            writer.endElement();
            writer.startElement("system-err");
            writeOutputs(writer, classId, methodResult.getId(), TestOutputEvent.Destination.StdErr);
            writer.endElement();
        }

        writer.endElement();
    }
}
项目:Pushjet-Android    文件:TestMethodResult.java   
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;
}
项目:Pushjet-Android    文件:JUnitTestEventAdapter.java   
@Override
public void testIgnored(Description description) throws Exception {
    if (methodName(description) == null) {
        // An @Ignored class, ignore the event. We don't get testIgnored events for each method, so we have
        // generate them on our own
        processIgnoredClass(description);
        return;
    }

    TestDescriptorInternal testInternal = descriptor(idGenerator.generateId(), description);
    resultProcessor.started(testInternal, startEvent());
    resultProcessor.completed(testInternal.getId(), new TestCompleteEvent(timeProvider.getCurrentTime(), TestResult.ResultType.SKIPPED));
}
项目:Pushjet-Android    文件:TestEventLogger.java   
private void after(TestDescriptor descriptor, TestResult result) {
    TestLogEvent event = getEvent(result);

    if (shouldLogEvent(descriptor, event)) {
        String details = shouldLogExceptions(result) ? exceptionFormatter.format(descriptor, result.getExceptions()) : null;
        logEvent(descriptor, event, details);
    }
}
项目:Pushjet-Android    文件:TestEventLogger.java   
private TestLogEvent getEvent(TestResult result) {
    switch (result.getResultType()) {
        case SUCCESS: return TestLogEvent.PASSED;
        case FAILURE: return TestLogEvent.FAILED;
        case SKIPPED: return TestLogEvent.SKIPPED;
        default: throw new AssertionError();
    }
}
项目:Pushjet-Android    文件:TestCountLogger.java   
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null) {
        if (failedTests > 0) {
            logger.error(TextUtil.getPlatformLineSeparator() + summary());
        }
        progressLogger.completed();

        if (result.getResultType() == TestResult.ResultType.FAILURE) {
            hadFailures = true;
        }
    }
}
项目:Pushjet-Android    文件:TestState.java   
public void completed(TestCompleteEvent event) {
    this.completeEvent = event;
    resultType = isFailed() ? TestResult.ResultType.FAILURE
            : event.getResultType() != null ? event.getResultType() : TestResult.ResultType.SUCCESS;

    if (!test.isComposite()) {
        testCount = 1;
        switch (resultType) {
            case SUCCESS:
                successfulCount = 1;
                break;
            case FAILURE:
                failedCount = 1;
                break;
        }
    }

    if (startEvent.getParentId() != null) {
        TestState parentState = executing.get(startEvent.getParentId());
        if (parentState != null) {
            if (isFailed()) {
                parentState.failedChild = true;
            }
            parentState.testCount += testCount;
            parentState.successfulCount += successfulCount;
            parentState.failedCount += failedCount;
        }
    }
}
项目:Pushjet-Android    文件:TestNGTestResultProcessorAdapter.java   
public void onConfigurationFailure(ITestResult testResult) {
    if (failedConfigurations.put(testResult, true) != null) {
        // workaround for bug in TestNG 6.2 (apparently fixed in some 6.3.x): listener is notified twice per event
        return;
    }
    // Synthesise a test for the broken configuration method
    TestDescriptorInternal test = new DefaultTestMethodDescriptor(idGenerator.generateId(),
            testResult.getMethod().getTestClass().getName(), testResult.getMethod().getMethodName());
    resultProcessor.started(test, new TestStartEvent(testResult.getStartMillis()));
    resultProcessor.failure(test.getId(), testResult.getThrowable());
    resultProcessor.completed(test.getId(), new TestCompleteEvent(testResult.getEndMillis(), TestResult.ResultType.FAILURE));
}
项目:Pushjet-Android    文件:TestClassResult.java   
public TestClassResult add(TestMethodResult methodResult) {
    if (methodResult.getResultType() == TestResult.ResultType.FAILURE) {
        failuresCount++;
    }
    if(methodResult.getResultType() == TestResult.ResultType.SKIPPED) {
        skippedCount++;
    }
    methodResults.add(methodResult);
    return this;
}
项目:Pushjet-Android    文件:JUnitXmlResultWriter.java   
private void writeTests(SimpleXmlWriter writer, Iterable<TestMethodResult> methodResults, String className, long classId) throws IOException {
    for (TestMethodResult methodResult : methodResults) {
        writer.startElement("testcase")
                .attribute("name", methodResult.getName())
                .attribute("classname", className)
                .attribute("time", String.valueOf(methodResult.getDuration() / 1000.0));

        if (methodResult.getResultType() == TestResult.ResultType.SKIPPED) {
            writer.startElement("skipped");
            writer.endElement();
        } else {
            for (TestFailure failure : methodResult.getFailures()) {
                writer.startElement("failure")
                        .attribute("message", failure.getMessage())
                        .attribute("type", failure.getExceptionType());

                writer.characters(failure.getStackTrace());

                writer.endElement();
            }
        }

        if (outputAssociation.equals(TestOutputAssociation.WITH_TESTCASE)) {
            writer.startElement("system-out");
            writeOutputs(writer, classId, methodResult.getId(), TestOutputEvent.Destination.StdOut);
            writer.endElement();
            writer.startElement("system-err");
            writeOutputs(writer, classId, methodResult.getId(), TestOutputEvent.Destination.StdErr);
            writer.endElement();
        }

        writer.endElement();
    }
}
项目:Pushjet-Android    文件:TestMethodResult.java   
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;
}
项目:Pushjet-Android    文件:JUnitTestEventAdapter.java   
@Override
public void testIgnored(Description description) throws Exception {
    if (methodName(description) == null) {
        // An @Ignored class, ignore the event. We don't get testIgnored events for each method, so we have
        // generate them on our own
        processIgnoredClass(description);
        return;
    }

    TestDescriptorInternal testInternal = descriptor(idGenerator.generateId(), description);
    resultProcessor.started(testInternal, startEvent());
    resultProcessor.completed(testInternal.getId(), new TestCompleteEvent(timeProvider.getCurrentTime(), TestResult.ResultType.SKIPPED));
}
项目:Pushjet-Android    文件:TestEventLogger.java   
private void after(TestDescriptor descriptor, TestResult result) {
    TestLogEvent event = getEvent(result);

    if (shouldLogEvent(descriptor, event)) {
        String details = shouldLogExceptions(result) ? exceptionFormatter.format(descriptor, result.getExceptions()) : null;
        logEvent(descriptor, event, details);
    }
}
项目:Pushjet-Android    文件:TestEventLogger.java   
private TestLogEvent getEvent(TestResult result) {
    switch (result.getResultType()) {
        case SUCCESS: return TestLogEvent.PASSED;
        case FAILURE: return TestLogEvent.FAILED;
        case SKIPPED: return TestLogEvent.SKIPPED;
        default: throw new AssertionError();
    }
}
项目:Pushjet-Android    文件:TestCountLogger.java   
public void afterSuite(TestDescriptor suite, TestResult result) {
    if (suite.getParent() == null) {
        if (failedTests > 0) {
            logger.error(TextUtil.getPlatformLineSeparator() + summary());
        }
        progressLogger.completed();

        if (result.getResultType() == TestResult.ResultType.FAILURE) {
            hadFailures = true;
        }
    }
}
项目:Pushjet-Android    文件:TestState.java   
public void completed(TestCompleteEvent event) {
    this.completeEvent = event;
    resultType = isFailed() ? TestResult.ResultType.FAILURE
            : event.getResultType() != null ? event.getResultType() : TestResult.ResultType.SUCCESS;

    if (!test.isComposite()) {
        testCount = 1;
        switch (resultType) {
            case SUCCESS:
                successfulCount = 1;
                break;
            case FAILURE:
                failedCount = 1;
                break;
        }
    }

    if (startEvent.getParentId() != null) {
        TestState parentState = executing.get(startEvent.getParentId());
        if (parentState != null) {
            if (isFailed()) {
                parentState.failedChild = true;
            }
            parentState.testCount += testCount;
            parentState.successfulCount += successfulCount;
            parentState.failedCount += failedCount;
        }
    }
}
项目:gradle-metrics-plugin    文件:GradleTestSuiteCollector.java   
@Override
public void afterTest(TestDescriptor testDescriptor, TestResult testResult) {
    checkNotNull(testDescriptor);
    checkNotNull(testResult);
    Result result = getTestResult(testResult);
    org.gradle.api.tasks.testing.Test testTask = (org.gradle.api.tasks.testing.Test) task;
    String suiteName = testTask.getName();
    long startTime = testResult.getStartTime();
    long elapsed = testResult.getEndTime() - startTime;
    Test test = new Test(testDescriptor.getName(), testDescriptor.getClassName(), suiteName, result, new DateTime(startTime), elapsed);
    dispatcherSupplier.get().test(test);
}