use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.
the class TestNGTreeHierarchyTest method testParallelTestExecutionPreserveInvocationCount.
@Test
public void testParallelTestExecutionPreserveInvocationCount() throws Exception {
final StringBuffer buf = new StringBuffer();
final IDEATestNGRemoteListener listener = createListener(buf);
listener.onStart((ISuite) null);
final MockTestNGResult[] results = new MockTestNGResult[] { new MockTestNGResult("ATest", "testName"), new MockTestNGResult("ATest", "testName1"), new MockTestNGResult("ATest", "testName") };
for (MockTestNGResult result : results) {
listener.onTestStart(result);
listener.onTestFinished(result);
}
listener.onFinish((ISuite) null);
Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + "\n" + "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" + "\n" + "##teamcity[testStarted name='ATest.testName' locationHint='java:test://ATest.testName|[0|]']\n" + "\n" + "##teamcity[testFinished name='ATest.testName']\n" + "\n" + "##teamcity[testStarted name='ATest.testName1' locationHint='java:test://ATest.testName1|[0|]']\n" + "\n" + "##teamcity[testFinished name='ATest.testName1']\n" + "\n" + "##teamcity[testStarted name='ATest.testName (1)' locationHint='java:test://ATest.testName|[1|]']\n" + "\n" + "##teamcity[testFinished name='ATest.testName (1)']\n" + "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
}
use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.
the class TestNGTreeHierarchyTest method doTest.
private static void doTest(XmlSuite suite, String expected) {
final StringBuffer buf = new StringBuffer();
final IDEATestNGRemoteListener listener = createListener(buf);
for (XmlTest test : suite.getTests()) {
for (XmlClass aClass : test.getClasses()) {
final String classFQName = aClass.getName();
for (XmlInclude include : aClass.getIncludedMethods()) {
final String methodName = include.getName();
List<Integer> numbers = include.getInvocationNumbers();
if (numbers.isEmpty()) {
numbers = Collections.singletonList(0);
}
for (Integer integer : numbers) {
final MockTestNGResult result = new MockTestNGResult(classFQName, methodName, null, new Object[] { integer });
listener.onTestStart(result);
listener.onTestFinished(result);
}
}
}
}
Assert.assertEquals("output: " + buf, expected, StringUtil.convertLineSeparators(buf.toString()));
}
use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.
the class TestNGTreeHierarchyTest method testConfigurationFailure.
@Test
public void testConfigurationFailure() throws Exception {
final StringBuffer buf = new StringBuffer();
final IDEATestNGRemoteListener listener = createListener(buf);
final String className = "a.ATest";
listener.onSuiteStart(className, true);
final MockTestNGResult setUp = new MockTestNGResult(className, "setUp", createExceptionWithoutTrace(), ArrayUtil.EMPTY_OBJECT_ARRAY);
listener.onConfigurationStart(setUp);
listener.onConfigurationFailure(setUp);
listener.onSuiteFinish(className);
Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + "\n" + "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" + "\n" + "##teamcity[testStarted name='ATest.setUp' locationHint='java:test://a.ATest.setUp' config='true']\n" + "\n" + "##teamcity[testFailed name='ATest.setUp' details='java.lang.Exception|n' error='true' message='']\n" + "\n" + "##teamcity[testFinished name='ATest.setUp']\n" + "##teamcity[testSuiteFinished name='a.ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
}
use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.
the class TestNGTreeHierarchyTest method testSkipTestMethod.
@Test
public void testSkipTestMethod() throws Exception {
final StringBuffer buf = new StringBuffer();
final IDEATestNGRemoteListener listener = createListener(buf);
listener.onStart((ISuite) null);
listener.onTestSkipped(new MockTestNGResult("ATest", "testName"));
listener.onFinish((ISuite) null);
Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + "\n" + "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" + "\n" + "##teamcity[testStarted name='ATest.testName' locationHint='java:test://ATest.testName|[0|]']\n" + "\n" + "##teamcity[testIgnored name='ATest.testName']\n" + "\n" + "##teamcity[testFinished name='ATest.testName']\n" + "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
}
Aggregations