Search in sources :

Example 1 with DefaultTestDescriptor

use of org.gradle.api.internal.tasks.testing.DefaultTestDescriptor in project gradle by gradle.

the class JUnitPlatformTestExecutionListener method createDescriptor.

private TestDescriptorInternal createDescriptor(TestIdentifier test, String name, String displayName) {
    TestIdentifier classIdentifier = findClassSource(test);
    String className = className(classIdentifier);
    String classDisplayName = classDisplayName(classIdentifier);
    return new DefaultTestDescriptor(idGenerator.generateId(), className, name, classDisplayName, displayName);
}
Also used : TestIdentifier(org.junit.platform.launcher.TestIdentifier) DefaultTestDescriptor(org.gradle.api.internal.tasks.testing.DefaultTestDescriptor)

Example 2 with DefaultTestDescriptor

use of org.gradle.api.internal.tasks.testing.DefaultTestDescriptor in project gradle by gradle.

the class TestClassExecutionEventGenerator method testClassFinished.

@Override
public void testClassFinished(Throwable failure) {
    long now = clock.getCurrentTime();
    try {
        if (failure != null) {
            if (currentTests.isEmpty()) {
                String testName = testsStarted ? "executionError" : "initializationError";
                DefaultTestDescriptor initializationError = new DefaultTestDescriptor(idGenerator.generateId(), currentTestClass.getClassName(), testName);
                resultProcessor.started(initializationError, new TestStartEvent(now));
                resultProcessor.failure(initializationError.getId(), failure);
                resultProcessor.completed(initializationError.getId(), new TestCompleteEvent(now));
            } else {
                for (Object test : currentTests) {
                    resultProcessor.failure(test, failure);
                    resultProcessor.completed(test, new TestCompleteEvent(now));
                }
            }
        }
        resultProcessor.completed(currentTestClass.getId(), new TestCompleteEvent(now));
    } finally {
        testsStarted = false;
        currentTests.clear();
        currentTestClass = null;
    }
}
Also used : DefaultTestDescriptor(org.gradle.api.internal.tasks.testing.DefaultTestDescriptor) TestStartEvent(org.gradle.api.internal.tasks.testing.TestStartEvent) TestCompleteEvent(org.gradle.api.internal.tasks.testing.TestCompleteEvent)

Aggregations

DefaultTestDescriptor (org.gradle.api.internal.tasks.testing.DefaultTestDescriptor)2 TestCompleteEvent (org.gradle.api.internal.tasks.testing.TestCompleteEvent)1 TestStartEvent (org.gradle.api.internal.tasks.testing.TestStartEvent)1 TestIdentifier (org.junit.platform.launcher.TestIdentifier)1