use of org.gradle.api.internal.tasks.testing.TestStartEvent in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onConfigurationFailure.
@Override
public void onConfigurationFailure(ITestResult testResult) {
ITestNGMethod testMethod = testResult.getMethod();
ITestClass testClass = testMethod.getTestClass();
TestClassInfo classInfo;
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;
}
classInfo = this.testClassInfo.get(testClass);
}
// Synthesise a test for the broken configuration method
TestDescriptorInternal test = new DefaultTestMethodDescriptor(idGenerator.generateId(), testClass.getName(), testMethod.getMethodName());
Object parentId = classInfo == null ? null : classInfo.id;
resultProcessor.started(test, new TestStartEvent(testResult.getStartMillis(), parentId));
resultProcessor.failure(test.getId(), testResult.getThrowable());
resultProcessor.completed(test.getId(), new TestCompleteEvent(testResult.getEndMillis(), TestResult.ResultType.FAILURE));
}
use of org.gradle.api.internal.tasks.testing.TestStartEvent in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onBeforeClass.
@Override
public void onBeforeClass(ITestClass testClass) {
TestDescriptorInternal testInternal = null;
Object parentId = null;
synchronized (lock) {
TestClassInfo info = testClassInfo.get(testClass);
if (info != null) {
info.incrementStartedCount();
} else {
testInternal = new DefaultTestClassDescriptor(idGenerator.generateId(), testClass.getName());
testClassInfo.put(testClass, new TestClassInfo(testInternal.getId()));
parentId = xmlTestIds.get(testClass.getXmlTest());
for (ITestNGMethod method : testClass.getTestMethods()) {
testMethodParentId.put(method, testInternal.getId());
}
}
}
if (testInternal != null) {
resultProcessor.started(testInternal, new TestStartEvent(clock.getCurrentTime(), parentId));
}
}
use of org.gradle.api.internal.tasks.testing.TestStartEvent 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.TestStartEvent in project gradle by gradle.
the class TestClassExecutionEventGenerator method testClassStarted.
@Override
public void testClassStarted(String testClassName) {
currentTestClass = new DefaultTestClassDescriptor(idGenerator.generateId(), testClassName);
resultProcessor.started(currentTestClass, new TestStartEvent(clock.getCurrentTime()));
}
use of org.gradle.api.internal.tasks.testing.TestStartEvent in project gradle by gradle.
the class TestMainAction method run.
@Override
public void run() {
TestDescriptorInternal suite = new RootTestSuiteDescriptor(rootTestSuiteId, displayName);
resultProcessor.started(suite, new TestStartEvent(clock.getCurrentTime()));
try {
processor.startProcessing(resultProcessor);
try {
detector.run();
} finally {
// Release worker lease while waiting for tests to complete
// Do not release any other locks, so that other test tasks from the same project do not start running
WorkerLeaseRegistry.WorkerLease currentWorkerLease = workerLeaseService.getCurrentWorkerLease();
workerLeaseService.withoutLocks(Collections.singletonList(currentWorkerLease), new Runnable() {
@Override
public void run() {
processor.stop();
}
});
}
} finally {
resultProcessor.completed(suite.getId(), new TestCompleteEvent(clock.getCurrentTime()));
}
}
Aggregations