use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class ClientForwardingTestOperationListener method started.
@Override
public void started(BuildOperationDescriptor buildOperation, OperationStartEvent startEvent) {
Object details = buildOperation.getDetails();
if (details instanceof ExecuteTaskBuildOperationDetails) {
Task task = ((ExecuteTaskBuildOperationDetails) details).getTask();
if (!(task instanceof Test)) {
return;
}
runningTasks.put(buildOperation.getId(), task.getPath());
} else if (details instanceof ExecuteTestBuildOperationType.Details) {
ExecuteTestBuildOperationType.Details testOperationDetails = (ExecuteTestBuildOperationType.Details) details;
TestDescriptorInternal testDescriptor = (TestDescriptorInternal) testOperationDetails.getTestDescriptor();
eventConsumer.dispatch(new DefaultTestStartedProgressEvent(testOperationDetails.getStartTime(), adapt(testDescriptor)));
}
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class StateTrackingTestResultProcessor method started.
@Override
public final void started(TestDescriptorInternal test, TestStartEvent event) {
TestDescriptorInternal parent = null;
if (event.getParentId() != null) {
parent = executing.get(event.getParentId()).test;
}
TestState state = new TestState(new DecoratingTestDescriptor(test, parent), event, executing);
TestState oldState = executing.put(test.getId(), state);
if (oldState != null) {
throw new IllegalArgumentException(String.format("Received a start event for %s with duplicate id '%s'.", test, test.getId()));
}
delegate.started(state.test, event);
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onBeforeClass.
@Override
public void onBeforeClass(ITestClass testClass) {
TestDescriptorInternal testInternal;
Object parentId;
synchronized (lock) {
testInternal = new DefaultTestClassDescriptor(idGenerator.generateId(), testClass.getName());
testClassId.put(testClass, testInternal.getId());
parentId = xmlTestIds.get(testClass.getXmlTest());
}
resultProcessor.started(testInternal, new TestStartEvent(clock.getCurrentTime(), parentId));
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onStart.
@Override
public void onStart(ISuite suite) {
TestDescriptorInternal testInternal;
synchronized (lock) {
if (suiteId.containsKey(suite)) {
// Can get duplicate start events
return;
}
Object id = idGenerator.generateId();
testInternal = new DefaultTestSuiteDescriptor(id, suite.getName());
suiteId.put(suite, testInternal.getId());
}
resultProcessor.started(testInternal, new TestStartEvent(clock.getCurrentTime()));
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onConfigurationFailure.
@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));
}
Aggregations