diff --git a/plugins/junit/test/com/intellij/execution/junit/JUnitTreeByDescriptionHierarchyTest.java b/plugins/junit/test/com/intellij/execution/junit/JUnitTreeByDescriptionHierarchyTest.java index cbf3d4fe8067..9343911baf47 100644 --- a/plugins/junit/test/com/intellij/execution/junit/JUnitTreeByDescriptionHierarchyTest.java +++ b/plugins/junit/test/com/intellij/execution/junit/JUnitTreeByDescriptionHierarchyTest.java @@ -33,7 +33,8 @@ import java.util.List; public class JUnitTreeByDescriptionHierarchyTest { @Test public void testEmptySuite() throws Exception { - doTest(Description.createSuiteDescription("empty suite"), "##teamcity[treeEnded]\n"); + doTest(Description.createSuiteDescription("empty suite"), "##teamcity[enteredTheMatrix]\n" + + "##teamcity[treeEnded]\n"); } @Test @@ -46,6 +47,7 @@ public class JUnitTreeByDescriptionHierarchyTest { attachParameterizedTests(className, aTestClass, tests); } doTest(root, tests, + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeStarted name='TestA' locationHint='java:suite://a.TestA']\n" + "##teamcity[suiteTreeStarted name='|[0|]' locationHint='java:suite://a.TestA.|[0|]']\n" + "##teamcity[suiteTreeNode name='testName|[0|]' locationHint='java:test://a.TestA.testName|[0|]']\n" + @@ -65,7 +67,6 @@ public class JUnitTreeByDescriptionHierarchyTest { "##teamcity[treeEnded]\n", - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + "##teamcity[testSuiteStarted name='TestA']\n" + "##teamcity[testSuiteStarted name='|[0|]']\n" + @@ -135,14 +136,14 @@ public class JUnitTreeByDescriptionHierarchyTest { tests.add(testDescription); aTestClass.addChild(testDescription); } - doTest(rootDescription, tests, "##teamcity[suiteTreeStarted name='MyTest' locationHint='java:suite://a.MyTest']\n" + + doTest(rootDescription, tests, "##teamcity[enteredTheMatrix]\n" + + "##teamcity[suiteTreeStarted name='MyTest' locationHint='java:suite://a.MyTest']\n" + "##teamcity[suiteTreeNode name='MyTest.testMe' locationHint='java:test://a.MyTest.testMe']\n" + "##teamcity[suiteTreeEnded name='MyTest']\n" + "##teamcity[suiteTreeStarted name='MyTest' locationHint='java:suite://b.MyTest']\n" + "##teamcity[suiteTreeNode name='MyTest.testMe' locationHint='java:test://b.MyTest.testMe']\n" + "##teamcity[suiteTreeEnded name='MyTest']\n" + "##teamcity[treeEnded]\n", - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + "##teamcity[testSuiteStarted name='MyTest']\n" + "##teamcity[testStarted name='MyTest.testMe' locationHint='java:test://a.MyTest.testMe']\n" + @@ -165,6 +166,7 @@ public class JUnitTreeByDescriptionHierarchyTest { attachParameterizedTests(className, aTestClassDescription, tests); doTest(aTestClassDescription, tests, //tree + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeStarted name='|[0|]' locationHint='java:suite://a.TestA.|[0|]']\n" + "##teamcity[suiteTreeNode name='testName|[0|]' locationHint='java:test://a.TestA.testName|[0|]']\n" + "##teamcity[suiteTreeEnded name='|[0|]']\n" + @@ -173,7 +175,6 @@ public class JUnitTreeByDescriptionHierarchyTest { "##teamcity[suiteTreeEnded name='|[1|]']\n" + "##teamcity[treeEnded]\n", //start - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'TestA' comment = 'a' location = 'java:suite://a.TestA']\n" + "##teamcity[testSuiteStarted name='|[0|]']\n" + "##teamcity[testStarted name='testName|[0|]' locationHint='java:test://a.TestA.testName|[0|]']\n" + @@ -201,6 +202,7 @@ public class JUnitTreeByDescriptionHierarchyTest { } doTest(aTestClassDescription, tests, //tree + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeStarted name='|[0|]' locationHint='java:suite://a.TestA.|[0|]']\n" + "##teamcity[suiteTreeNode name='testName|[0|]' locationHint='java:test://a.TestA.testName|[0|]']\n" + "##teamcity[suiteTreeEnded name='|[0|]']\n" + @@ -209,7 +211,6 @@ public class JUnitTreeByDescriptionHierarchyTest { "##teamcity[suiteTreeEnded name='|[0|]']\n" + "##teamcity[treeEnded]\n", //start - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'TestA' comment = 'a' location = 'java:suite://a.TestA']\n" + "##teamcity[testSuiteStarted name='|[0|]']\n" + "##teamcity[testStarted name='testName|[0|]' locationHint='java:test://a.TestA.testName|[0|]']\n" + @@ -237,6 +238,7 @@ public class JUnitTreeByDescriptionHierarchyTest { } doTest(aTestClassDescription, tests, //tree + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeStarted name='|[0: with - 1.1|]' locationHint='java:suite://a.TestA.|[0: with - 1.1|]']\n" + "##teamcity[suiteTreeNode name='testName|[0: with - 1.1|]' locationHint='java:test://a.TestA.testName|[0: with - 1.1|]']\n" + "##teamcity[suiteTreeEnded name='|[0: with - 1.1|]']\n" + @@ -245,7 +247,6 @@ public class JUnitTreeByDescriptionHierarchyTest { "##teamcity[suiteTreeEnded name='|[1: with - 2.1|]']\n" + "##teamcity[treeEnded]\n", //start - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'TestA' comment = 'a' location = 'java:suite://a.TestA']\n" + "##teamcity[testSuiteStarted name='|[0: with - 1.1|]']\n" + "##teamcity[testStarted name='testName|[0: with - 1.1|]' locationHint='java:test://a.TestA.testName|[0: with - 1.1|]']\n" + @@ -277,6 +278,7 @@ public class JUnitTreeByDescriptionHierarchyTest { doTest(root, tests, //expected tree + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeStarted name='ASuite1' locationHint='java:suite://ASuite1']\n" + "##teamcity[suiteTreeStarted name='ATest' locationHint='java:suite://ATest']\n" + "##teamcity[suiteTreeNode name='ATest.test1' locationHint='java:test://ATest.test1']\n" + @@ -290,7 +292,6 @@ public class JUnitTreeByDescriptionHierarchyTest { "##teamcity[treeEnded]\n", //started - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + "##teamcity[testSuiteStarted name='ASuite1']\n" + "##teamcity[testSuiteStarted name='ATest']\n" + @@ -339,7 +340,8 @@ public class JUnitTreeByDescriptionHierarchyTest { final JUnit4TestListener sender = createListener(buf); sender.sendTree(root); - Assert.assertEquals("output: " + buf, "##teamcity[suiteTreeStarted name='TestA' locationHint='java:suite://TestA']\n" + + Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + + "##teamcity[suiteTreeStarted name='TestA' locationHint='java:suite://TestA']\n" + "##teamcity[suiteTreeNode name='TestA.testName' locationHint='java:test://TestA.testName']\n" + "##teamcity[suiteTreeEnded name='TestA']\n" + "##teamcity[treeEnded]\n", StringUtil.convertLineSeparators(buf.toString())); @@ -352,8 +354,7 @@ public class JUnitTreeByDescriptionHierarchyTest { sender.testAssumptionFailure(new Failure(testA, exception)); sender.testRunFinished(new Result()); - Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + - "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + + Assert.assertEquals("output: " + buf, "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + "##teamcity[testSuiteStarted name='TestA']\n" + "##teamcity[testStarted name='TestA.testName' locationHint='java:test://TestA.testName']\n" + "\n" + @@ -377,7 +378,8 @@ public class JUnitTreeByDescriptionHierarchyTest { final JUnit4TestListener sender = createListener(buf); sender.sendTree(root); - Assert.assertEquals("output: " + buf, "##teamcity[suiteTreeStarted name='TestA' locationHint='java:suite://TestA']\n" + + Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + + "##teamcity[suiteTreeStarted name='TestA' locationHint='java:suite://TestA']\n" + "##teamcity[suiteTreeStarted name='param' locationHint='java:suite://param']\n" + "##teamcity[suiteTreeNode name='TestA.testName' locationHint='java:test://TestA.testName']\n" + "##teamcity[suiteTreeEnded name='param']\n" + @@ -392,8 +394,7 @@ public class JUnitTreeByDescriptionHierarchyTest { sender.testAssumptionFailure(new Failure(testA, exception)); sender.testRunFinished(new Result()); - Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + - "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + + Assert.assertEquals("output: " + buf, "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + "##teamcity[testSuiteStarted name='TestA']\n" + "##teamcity[testSuiteStarted name='param']\n" + "##teamcity[testStarted name='TestA.testName' locationHint='java:test://TestA.testName']\n" + @@ -410,8 +411,7 @@ public class JUnitTreeByDescriptionHierarchyTest { sender.testAssumptionFailure(new Failure(testName, exception)); sender.testRunFinished(new Result()); - Assert.assertEquals("output: " + buf, "##teamcity[enteredTheMatrix]\n" + - "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + + Assert.assertEquals("output: " + buf, "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + "\n" + "##teamcity[testIgnored name='TestA.testName' details='java.lang.Exception|n' error='true' message='']\n", StringUtil.convertLineSeparators(buf.toString())); @@ -420,10 +420,10 @@ public class JUnitTreeByDescriptionHierarchyTest { @Test public void testSingleMethod() throws Exception { final Description rootDescription = Description.createTestDescription("TestA", "testName"); - doTest(rootDescription, Collections.singletonList(rootDescription), + doTest(rootDescription, Collections.singletonList(rootDescription), + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeNode name='TestA.testName' locationHint='java:test://TestA.testName']\n" + "##teamcity[treeEnded]\n", - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'TestA' location = 'java:suite://TestA']\n" + "##teamcity[testStarted name='TestA.testName' locationHint='java:test://TestA.testName']\n" + "\n" + @@ -496,6 +496,7 @@ public class JUnitTreeByDescriptionHierarchyTest { testMethod.addChild(testDescription); } doTest(aTestClass, tests, + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeStarted name='testName' locationHint='java:suite://testName']\n" + "##teamcity[suiteTreeNode name='ATest.testName|[0|]' locationHint='java:test://ATest.testName|[0|]']\n" + "##teamcity[suiteTreeNode name='ATest.testName|[1|]' locationHint='java:test://ATest.testName|[1|]']\n" + @@ -503,7 +504,6 @@ public class JUnitTreeByDescriptionHierarchyTest { "##teamcity[treeEnded]\n", - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'ATest' location = 'java:suite://ATest']\n" + "##teamcity[testSuiteStarted name='testName']\n" + "##teamcity[testStarted name='ATest.testName|[0|]' locationHint='java:test://ATest.testName|[0|]']\n" + @@ -530,6 +530,7 @@ public class JUnitTreeByDescriptionHierarchyTest { aTestClassWithJUnit3Test.addChild(testDescription); tests.add(testDescription); doTest(root, tests, + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeStarted name='ATest' locationHint='java:suite://ATest']\n" + "##teamcity[suiteTreeStarted name='|[0|]' locationHint='java:suite://ATest.|[0|]']\n" + "##teamcity[suiteTreeNode name='testName|[0|]' locationHint='java:test://ATest.testName|[0|]']\n" + @@ -546,7 +547,6 @@ public class JUnitTreeByDescriptionHierarchyTest { "##teamcity[treeEnded]\n", //start - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'root' location = 'java:suite://root']\n" + "##teamcity[testSuiteStarted name='ATest']\n" + "##teamcity[testSuiteStarted name='|[0|]']\n" + @@ -593,11 +593,10 @@ public class JUnitTreeByDescriptionHierarchyTest { final Description emptyDescription = Description.createTestDescription(JUnit4TestListener.EMPTY_SUITE_NAME, JUnit4TestListener.EMPTY_SUITE_WARNING); description.addChild(emptyDescription); doTest(description, Collections.singletonList(emptyDescription), + "##teamcity[enteredTheMatrix]\n" + "##teamcity[suiteTreeNode name='TestSuite$1.warning' locationHint='java:test://junit.framework.TestSuite$1.warning']\n" + "##teamcity[treeEnded]\n", - - "##teamcity[enteredTheMatrix]\n" + "##teamcity[rootName name = 'TestA' location = 'java:suite://TestA']\n" + "##teamcity[testStarted name='TestSuite$1.warning' locationHint='java:test://junit.framework.TestSuite$1.warning']\n" + "\n" + diff --git a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java index d757df8370be..b93c0ab19131 100644 --- a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java +++ b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java @@ -50,11 +50,12 @@ public class JUnit4TestListener extends RunListener { private long myCurrentTestStart; public JUnit4TestListener() { - myPrintStream = System.out; + this(System.out); } public JUnit4TestListener(PrintStream printStream) { myPrintStream = printStream; + myPrintStream.println("##teamcity[enteredTheMatrix]"); } private static String escapeName(String str) { @@ -62,7 +63,6 @@ public class JUnit4TestListener extends RunListener { } public void testRunStarted(Description description) throws Exception { - myPrintStream.println("##teamcity[enteredTheMatrix]"); if (myRootName != null && !myRootName.startsWith("[")) { int lastPointIdx = myRootName.lastIndexOf('.'); String name = myRootName; diff --git a/plugins/testng/testSources/com/theoryinpractice/testng/configuration/TestNGTreeHierarchyTest.java b/plugins/testng/testSources/com/theoryinpractice/testng/configuration/TestNGTreeHierarchyTest.java index 3e1a36fb2217..814d0eeeb860 100644 --- a/plugins/testng/testSources/com/theoryinpractice/testng/configuration/TestNGTreeHierarchyTest.java +++ b/plugins/testng/testSources/com/theoryinpractice/testng/configuration/TestNGTreeHierarchyTest.java @@ -46,7 +46,8 @@ public class TestNGTreeHierarchyTest { test.getClasses().add(xmlClass); suite.getTests().add(test); - doTest(suite, "\n" + + doTest(suite,"##teamcity[enteredTheMatrix]\n" + + "\n" + "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" + "\n" + "##teamcity[testStarted name='ATest.test1|[0|]' locationHint='java:test://a.ATest.test1|[0|]']\n" + @@ -187,7 +188,8 @@ public class TestNGTreeHierarchyTest { test.getClasses().add(xmlClass); suite.getTests().add(test); - doTest(suite, "\n" + + doTest(suite, "##teamcity[enteredTheMatrix]\n" + + "\n" + "##teamcity[testSuiteStarted name ='ATest' locationHint = 'java:suite://a.ATest']\n" + "\n" + "##teamcity[testStarted name='ATest.test1|[0|]' locationHint='java:test://a.ATest.test1|[0|]']\n" + @@ -222,7 +224,8 @@ public class TestNGTreeHierarchyTest { } listener.onSuiteFinish(className); - Assert.assertEquals("output: " + buf, "\n" + + 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" + @@ -262,7 +265,8 @@ public class TestNGTreeHierarchyTest { listener.onConfigurationFailure(setUp); listener.onSuiteFinish(className); - Assert.assertEquals("output: " + buf, "\n" + + 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" + @@ -279,7 +283,8 @@ public class TestNGTreeHierarchyTest { final MockTestNGResult result = new MockTestNGResult("ATest", "testMe", null, new Object[]{null, null}); listener.onTestStart(result); listener.onTestFinished(result); - Assert.assertEquals("output: " + buf, "\n" + + 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" + diff --git a/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java b/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java index 3553dfc4e34d..5664908788bf 100644 --- a/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java +++ b/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java @@ -21,15 +21,15 @@ public class IDEATestNGRemoteListener implements ISuiteListener, IResultListener private final Map myParamsMap = new HashMap(); public IDEATestNGRemoteListener() { - myPrintStream = System.out; + this(System.out); } public IDEATestNGRemoteListener(PrintStream printStream) { myPrintStream = printStream; + myPrintStream.println("##teamcity[enteredTheMatrix]"); } public synchronized void onStart(final ISuite suite) { - myPrintStream.println("##teamcity[enteredTheMatrix]"); if (suite != null) { final List allMethods = suite.getAllMethods(); if (allMethods != null) {