use of com.intellij.execution.testframework.sm.runner.ui.MockPrinter in project intellij-community by JetBrains.
the class SMTRunnerConsoleTest method testProcessor_OnFailure_Comparision_MultilineTexts.
public void testProcessor_OnFailure_Comparision_MultilineTexts() {
final SMTestProxy myTest1 = startTestWithPrinter("my_test");
myEventsProcessor.onTestFailure(new TestFailedEvent("my_test", "error msg", "method1:1\nmethod2:2", false, "this is:\nactual", "this is:\nexpected"));
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stdout1 ", true));
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stderr1 ", false));
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "\nerror msg \n" + "\n" + "method1:1\n" + "method2:2\n" + "stderr1 ", "");
final MockPrinter mockPrinter1 = new MockPrinter(true);
mockPrinter1.onNewAvailable(myTest1);
assertAllOutputs(mockPrinter1, "stdout1 ", "stderr1 \n" + "error msg \n" + "\n" + "method1:1\n" + "method2:2\n", "");
}
use of com.intellij.execution.testframework.sm.runner.ui.MockPrinter in project intellij-community by JetBrains.
the class SMTRunnerConsoleTest method testProcessor_OnFailure_Comparision_Strings.
public void testProcessor_OnFailure_Comparision_Strings() {
final SMTestProxy myTest1 = startTestWithPrinter("my_test");
myEventsProcessor.onTestFailure(new TestFailedEvent("my_test", "error msg", "method1:1\nmethod2:2", false, "actual", "expected"));
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stdout1 ", true));
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stderr1 ", false));
assertAllOutputs(myMockResettablePrinter, // std out
"stdout1 ", // std err
"\n" + "error msg\n" + "expected\n" + "actual\n" + " \n" + "\n" + "method1:1\n" + "method2:2\n" + "stderr1 ", // std sys
"Expected :Actual :");
final MockPrinter mockPrinter1 = new MockPrinter(true);
mockPrinter1.onNewAvailable(myTest1);
assertAllOutputs(mockPrinter1, // std out
"stdout1 ", // std err
"stderr1 \nerror msg\n" + "expected\n" + "actual\n" + " \n" + "\n" + "method1:1\nmethod2:2\n", // std sys
"Expected :Actual :");
}
use of com.intellij.execution.testframework.sm.runner.ui.MockPrinter in project intellij-community by JetBrains.
the class SMTRunnerConsoleTest method testProcessor_OnIgnored.
public void testProcessor_OnIgnored() {
final SMTestProxy myTest1 = startTestWithPrinter("my_test");
myEventsProcessor.onTestIgnored(new TestIgnoredEvent("my_test", "ignored msg", null));
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stdout1 ", true));
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stderr1 ", false));
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg\n");
final MockPrinter mockPrinter1 = new MockPrinter(true);
mockPrinter1.onNewAvailable(myTest1);
assertAllOutputs(mockPrinter1, "stdout1 ", "stderr1 ", "\nignored msg\n");
//other output order
final SMTestProxy myTest2 = startTestWithPrinter("my_test2");
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test2", "stdout1 ", true));
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test2", "stderr1 ", false));
myEventsProcessor.onTestIgnored(new TestIgnoredEvent("my_test2", "ignored msg", null));
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg\n");
final MockPrinter mockPrinter2 = new MockPrinter(true);
mockPrinter2.onNewAvailable(myTest2);
assertAllOutputs(mockPrinter2, "stdout1 ", "stderr1 ", "\nignored msg\n");
}
use of com.intellij.execution.testframework.sm.runner.ui.MockPrinter in project intellij-community by JetBrains.
the class SMTestProxyTest method testTestFailedTwice.
public void testTestFailedTwice() {
mySimpleTest.setStarted();
mySimpleTest.setTestFailed("msg 1", "stack trace 1", false);
assertFalse(mySimpleTest.isInProgress());
assertTrue(mySimpleTest.wasLaunched());
assertTrue(mySimpleTest.isDefect());
assertTrue(mySimpleTest.getMagnitudeInfo() == Magnitude.FAILED_INDEX);
final MockPrinter printer = new MockPrinter(true);
mySimpleTest.printOn(printer);
assertEquals("", printer.getStdOut());
assertEquals("\nmsg 1\nstack trace 1\n", printer.getStdErr());
assertEquals("", printer.getStdSys());
mySimpleTest.setTestFailed("msg 2", "stack trace 2", false);
assertFalse(mySimpleTest.isInProgress());
assertTrue(mySimpleTest.wasLaunched());
assertTrue(mySimpleTest.isDefect());
assertTrue(mySimpleTest.getMagnitudeInfo() == Magnitude.FAILED_INDEX);
printer.resetIfNecessary();
mySimpleTest.printOn(printer);
assertEquals("", printer.getStdOut());
assertEquals("\nmsg 1\nstack trace 1\n\nmsg 2\nstack trace 2\n", printer.getStdErr());
assertEquals("", printer.getStdSys());
mySimpleTest.setFinished();
assertFalse(mySimpleTest.isInProgress());
assertTrue(mySimpleTest.wasLaunched());
assertTrue(mySimpleTest.isDefect());
assertTrue(mySimpleTest.getMagnitudeInfo() == Magnitude.FAILED_INDEX);
}
use of com.intellij.execution.testframework.sm.runner.ui.MockPrinter in project intellij-community by JetBrains.
the class SMTestProxyTest method testMultipleAssertions.
public void testMultipleAssertions() {
mySimpleTest.setStarted();
mySimpleTest.setTestComparisonFailed("a", "stacktrace", "actual1", "expected1");
mySimpleTest.setTestComparisonFailed("b", "stacktrace", "actual2", "expected2");
mySimpleTest.setTestFailed("c", "stacktrace", false);
mySimpleTest.setFinished();
final MockPrinter printer = new MockPrinter(true) {
@Override
public void printHyperlink(String text, HyperlinkInfo info) {
print(text, ConsoleViewContentType.SYSTEM_OUTPUT);
}
};
mySimpleTest.printOn(printer);
assertEquals("", printer.getStdOut());
assertEquals("\n" + "a\n" + "Expected :expected1\n" + "Actual :actual1\n" + " <Click to see difference>\n" + "\n" + "stacktrace\n" + "\n" + "b\n" + "Expected :expected2\n" + "Actual :actual2\n" + " <Click to see difference>\n" + "\n" + "stacktrace\n" + "\n" + "c\n" + "stacktrace\n", printer.getAllOut());
}
Aggregations