Search in sources :

Example 1 with IDEATestNGRemoteListener

use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.

the class TestNGTreeHierarchyTest method testFailureWithoutStart.

@Test
public void testFailureWithoutStart() throws Exception {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    listener.onStart((ISuite) null);
    listener.onTestFailure(new MockTestNGResult("ATest", "testName", createExceptionWithoutTrace(), ArrayUtil.EMPTY_OBJECT_ARRAY));
    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[testFailed name='ATest.testName' details='java.lang.Exception|n' error='true' message='']\n" + "\n" + "##teamcity[testFinished name='ATest.testName']\n" + "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
}
Also used : IDEATestNGRemoteListener(org.testng.IDEATestNGRemoteListener) Test(org.junit.Test) XmlTest(org.testng.xml.XmlTest)

Example 2 with IDEATestNGRemoteListener

use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.

the class TestNGTreeHierarchyTest method testSkipMethodAfterStartTest.

@Test
public void testSkipMethodAfterStartTest() throws Exception {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    listener.onStart((ISuite) null);
    final MockTestNGResult result = new MockTestNGResult("ATest", "testName");
    listener.onTestStart(result);
    listener.onTestSkipped(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[testIgnored name='ATest.testName']\n" + "\n" + "##teamcity[testFinished name='ATest.testName']\n" + "##teamcity[testSuiteFinished name='ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
}
Also used : IDEATestNGRemoteListener(org.testng.IDEATestNGRemoteListener) Test(org.junit.Test) XmlTest(org.testng.xml.XmlTest)

Example 3 with IDEATestNGRemoteListener

use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.

the class TestNGTreeHierarchyTest method testNullParameters.

@Test
public void testNullParameters() throws Exception {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    final MockTestNGResult result = new MockTestNGResult("ATest", "testMe", null, new Object[] { null, null });
    listener.onTestStart(result);
    listener.onTestFinished(result);
    Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + "\n" + "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://ATest']\n" + "\n" + "##teamcity[testStarted name='ATest.testMe|[null, null|]' locationHint='java:test://ATest.testMe|[0|]']\n" + "\n" + "##teamcity[testFinished name='ATest.testMe|[null, null|]']\n", StringUtil.convertLineSeparators(buf.toString()));
}
Also used : IDEATestNGRemoteListener(org.testng.IDEATestNGRemoteListener) Test(org.junit.Test) XmlTest(org.testng.xml.XmlTest)

Example 4 with IDEATestNGRemoteListener

use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.

the class TestNGTreeHierarchyTest method testConfigurationMethods.

@Test
public void testConfigurationMethods() throws Exception {
    final StringBuffer buf = new StringBuffer();
    final IDEATestNGRemoteListener listener = createListener(buf);
    final String className = "a.ATest";
    listener.onSuiteStart(className, true);
    for (String methodName : new String[] { "test1", "test2" }) {
        final MockTestNGResult setUp = new MockTestNGResult(className, "setUp");
        listener.onConfigurationStart(setUp);
        listener.onConfigurationSuccess(setUp);
        final MockTestNGResult result = new MockTestNGResult(className, methodName);
        listener.onTestStart(result);
        listener.onTestFinished(result);
        final MockTestNGResult tearDown = new MockTestNGResult(className, "tearDown");
        listener.onConfigurationStart(tearDown);
        listener.onConfigurationSuccess(tearDown);
    }
    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[testFinished name='ATest.setUp']\n" + "\n" + "##teamcity[testStarted name='ATest.test1' locationHint='java:test://a.ATest.test1|[0|]']\n" + "\n" + "##teamcity[testFinished name='ATest.test1']\n" + "\n" + "##teamcity[testStarted name='ATest.tearDown' locationHint='java:test://a.ATest.tearDown' config='true']\n" + "\n" + "##teamcity[testFinished name='ATest.tearDown']\n" + "\n" + "##teamcity[testStarted name='ATest.setUp' locationHint='java:test://a.ATest.setUp' config='true']\n" + "\n" + "##teamcity[testFinished name='ATest.setUp']\n" + "\n" + "##teamcity[testStarted name='ATest.test2' locationHint='java:test://a.ATest.test2|[0|]']\n" + "\n" + "##teamcity[testFinished name='ATest.test2']\n" + "\n" + "##teamcity[testStarted name='ATest.tearDown' locationHint='java:test://a.ATest.tearDown' config='true']\n" + "\n" + "##teamcity[testFinished name='ATest.tearDown']\n" + "##teamcity[testSuiteFinished name='a.ATest']\n", StringUtil.convertLineSeparators(buf.toString()));
}
Also used : IDEATestNGRemoteListener(org.testng.IDEATestNGRemoteListener) Test(org.junit.Test) XmlTest(org.testng.xml.XmlTest)

Example 5 with IDEATestNGRemoteListener

use of org.testng.IDEATestNGRemoteListener in project intellij-community by JetBrains.

the class TestNGTreeHierarchyTest method testParallelSameNameTestExecution.

@Test
public void testParallelSameNameTestExecution() 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("BTest", "testName") };
    for (MockTestNGResult result : results) {
        listener.onTestStart(result);
    }
    for (MockTestNGResult result : results) {
        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" + "##teamcity[testSuiteFinished name='ATest']\n" + "\n" + "##teamcity[testSuiteStarted name ='BTest' locationHint = 'java:suite://BTest']\n" + "\n" + "##teamcity[testStarted name='BTest.testName' locationHint='java:test://BTest.testName|[0|]']\n" + "\n" + "##teamcity[testFinished name='ATest.testName']\n" + "\n" + "##teamcity[testFinished name='BTest.testName']\n" + "##teamcity[testSuiteFinished name='BTest']\n", StringUtil.convertLineSeparators(buf.toString()));
}
Also used : IDEATestNGRemoteListener(org.testng.IDEATestNGRemoteListener) Test(org.junit.Test) XmlTest(org.testng.xml.XmlTest)

Aggregations

IDEATestNGRemoteListener (org.testng.IDEATestNGRemoteListener)9 XmlTest (org.testng.xml.XmlTest)9 Test (org.junit.Test)8 XmlClass (org.testng.xml.XmlClass)1 XmlInclude (org.testng.xml.XmlInclude)1