Search in sources :

Example 6 with TestIdentifier

use of org.junit.platform.launcher.TestIdentifier in project intellij-community by JetBrains.

the class JUnit5EventsTest method containerFailure.

@Test
void containerFailure() throws Exception {
    ClassTestDescriptor classTestDescriptor = new ClassTestDescriptor(UniqueId.forEngine("engine"), TestClass.class);
    TestDescriptor testDescriptor = new TestFactoryTestDescriptor(UniqueId.forEngine("engine1"), TestClass.class, TestClass.class.getDeclaredMethod("brokenStream"));
    TestIdentifier identifier = TestIdentifier.from(testDescriptor);
    final TestPlan testPlan = TestPlan.from(Collections.singleton(classTestDescriptor));
    myExecutionListener.sendTree(testPlan, "");
    myExecutionListener.executionStarted(identifier);
    myExecutionListener.executionFinished(identifier, TestExecutionResult.failed(new IllegalStateException()));
    Assertions.assertEquals("##teamcity[enteredTheMatrix]\n" + "##teamcity[treeEnded]\n" + "##teamcity[testSuiteStarted id='|[engine:engine1|]' name='brokenStream()']\n" + "\n" + "##teamcity[testStarted name='Class Configuration' locationHint='java:suite://com.intellij.junit5.JUnit5EventsTest$TestClass.brokenStream']\n" + "\n" + "##teamcity[testFailed name='Class Configuration' id='Class Configuration' details='TRACE' error='true' message='']\n" + "\n" + "##teamcity[testFinished name='Class Configuration']\n" + "##teamcity[testSuiteFinished  id='|[engine:engine1|]' name='brokenStream()']\n", StringUtil.convertLineSeparators(myBuf.toString()));
}
Also used : TestFactoryTestDescriptor(org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor) TestPlan(org.junit.platform.launcher.TestPlan) TestIdentifier(org.junit.platform.launcher.TestIdentifier) ClassTestDescriptor(org.junit.jupiter.engine.descriptor.ClassTestDescriptor) MethodTestDescriptor(org.junit.jupiter.engine.descriptor.MethodTestDescriptor) TestFactoryTestDescriptor(org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor) ClassTestDescriptor(org.junit.jupiter.engine.descriptor.ClassTestDescriptor) TestDescriptor(org.junit.platform.engine.TestDescriptor)

Example 7 with TestIdentifier

use of org.junit.platform.launcher.TestIdentifier in project intellij-community by JetBrains.

the class JUnit5NavigationTest method methodNavigation.

@Test
void methodNavigation() throws Exception {
    UniqueId uniqueId = UniqueId.parse("[class:JUnit5NavigationTest]/[method:methodNavigation]");
    MethodTestDescriptor methodTestDescriptor = new MethodTestDescriptor(uniqueId, JUnit5NavigationTest.class, JUnit5NavigationTest.class.getDeclaredMethod("methodNavigation"));
    TestIdentifier testIdentifier = TestIdentifier.from(methodTestDescriptor);
    Assertions.assertEquals(JUnit5NavigationTest.class.getName(), JUnit5TestExecutionListener.getClassName(testIdentifier));
    Assertions.assertEquals("methodNavigation", JUnit5TestExecutionListener.getMethodName(testIdentifier));
//Assertions.assertEquals("methodNavigation", testIdentifier.getDisplayName()); todo methodNavigation()
}
Also used : UniqueId(org.junit.platform.engine.UniqueId) MethodTestDescriptor(org.junit.jupiter.engine.descriptor.MethodTestDescriptor) TestIdentifier(org.junit.platform.launcher.TestIdentifier) Test(org.junit.jupiter.api.Test)

Example 8 with TestIdentifier

use of org.junit.platform.launcher.TestIdentifier in project intellij-community by JetBrains.

the class JUnit5NavigationTest method locationHintValue.

private String locationHintValue() {
    descriptor.use(myTestSource);
    TestIdentifier testIdentifier = TestIdentifier.from(descriptor);
    return JUnit5TestExecutionListener.getLocationHintValue(testIdentifier.getSource().orElseThrow(IllegalStateException::new), testIdentifier.isTest());
}
Also used : TestIdentifier(org.junit.platform.launcher.TestIdentifier)

Aggregations

TestIdentifier (org.junit.platform.launcher.TestIdentifier)8 MethodTestDescriptor (org.junit.jupiter.engine.descriptor.MethodTestDescriptor)3 ClassTestDescriptor (org.junit.jupiter.engine.descriptor.ClassTestDescriptor)2 TestFactoryTestDescriptor (org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor)2 TestDescriptor (org.junit.platform.engine.TestDescriptor)2 DefaultTestDescriptor (org.gradle.api.internal.tasks.testing.DefaultTestDescriptor)1 Test (org.junit.jupiter.api.Test)1 UniqueId (org.junit.platform.engine.UniqueId)1 TestPlan (org.junit.platform.launcher.TestPlan)1 AssertionFailedError (org.opentest4j.AssertionFailedError)1 MultipleFailuresError (org.opentest4j.MultipleFailuresError)1