use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class TestExecutionResultEvaluator method getTaskPath.
private String getTaskPath(TestDescriptorInternal givenDescriptor) {
TestDescriptorInternal descriptor = givenDescriptor;
while (descriptor.getOwnerBuildOperationId() == null && descriptor.getParent() != null) {
descriptor = descriptor.getParent();
}
String taskPath = runningTasks.get(descriptor.getOwnerBuildOperationId());
if (taskPath == null) {
throw new IllegalStateException("No parent task for test " + givenDescriptor);
}
return taskPath;
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class GenericJUnitTestEventAdapter method testFailure.
public void testFailure(T identifier, TestDescriptorInternal descriptor, Throwable exception) {
TestDescriptorInternal testInternal;
synchronized (lock) {
testInternal = executing.get(identifier);
}
boolean needEndEvent = false;
if (testInternal == null) {
// This can happen when, for example, a @BeforeClass or @AfterClass method fails
needEndEvent = true;
testInternal = descriptor;
resultProcessor.started(testInternal, startEvent());
}
resultProcessor.failure(testInternal.getId(), exception);
if (needEndEvent) {
resultProcessor.completed(testInternal.getId(), new TestCompleteEvent(clock.getCurrentTime()));
}
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class GenericJUnitTestEventAdapter method testFinished.
public void testFinished(T identifier) {
long endTime = clock.getCurrentTime();
TestDescriptorInternal testInternal;
TestResult.ResultType resultType;
synchronized (lock) {
testInternal = executing.remove(identifier);
if (testInternal == null && executing.size() == 1) {
// Assume that test has renamed itself (this can actually happen)
testInternal = executing.values().iterator().next();
executing.clear();
}
assert testInternal != null : String.format("Unexpected end event for %s", identifier);
resultType = assumptionFailed.remove(identifier) ? TestResult.ResultType.SKIPPED : null;
}
resultProcessor.completed(testInternal.getId(), new TestCompleteEvent(endTime, resultType));
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onStart.
@Override
public void onStart(ITestContext iTestContext) {
TestDescriptorInternal testInternal;
Object parentId;
synchronized (lock) {
Object id = idGenerator.generateId();
testInternal = new DefaultTestSuiteDescriptor(id, iTestContext.getName());
parentId = suiteId.get(iTestContext.getSuite());
xmlTestIds.put(iTestContext.getCurrentXmlTest(), id);
testId.put(iTestContext, testInternal.getId());
for (ITestNGMethod method : iTestContext.getAllTestMethods()) {
testMethodParentId.put(method, testInternal.getId());
}
}
resultProcessor.started(testInternal, new TestStartEvent(iTestContext.getStartDate().getTime(), parentId));
}
use of org.gradle.api.internal.tasks.testing.TestDescriptorInternal in project gradle by gradle.
the class TestNGTestResultProcessorAdapter method onTestStart.
@Override
public void onTestStart(ITestResult iTestResult) {
TestDescriptorInternal testInternal;
Object parentId;
synchronized (lock) {
String name = calculateTestCaseName(iTestResult);
testInternal = new DefaultTestMethodDescriptor(idGenerator.generateId(), iTestResult.getTestClass().getName(), name);
Object oldTestId = testMethodId.put(iTestResult, testInternal.getId());
assert oldTestId == null : "Apparently some other test has started but it hasn't finished. " + "Expect the resultProcessor to break. " + "Don't expect to see this assertion stack trace due to the current architecture";
parentId = testMethodParentId.get(iTestResult.getMethod());
assert parentId != null;
}
resultProcessor.started(testInternal, new TestStartEvent(iTestResult.getStartMillis(), parentId));
if (iTestResult.getThrowable() instanceof UnrepresentableParameterException) {
throw (UnrepresentableParameterException) iTestResult.getThrowable();
}
}
Aggregations