use of com.facebook.buck.test.TestCaseSummary in project buck by facebook.
the class TestResultFormatterTest method shouldIndicateThatNoTestRanIfNoneRanAndUsingFilter.
@Test
public void shouldIndicateThatNoTestRanIfNoneRanAndUsingFilter() {
TestResultFormatter formatter = createSilentFormatter();
TestCaseSummary summary = new TestCaseSummary("com.example.FooTest", ImmutableList.of());
TestResults results = FakeTestResults.of(ImmutableList.of(summary));
ImmutableList.Builder<String> builder = ImmutableList.builder();
formatter.runComplete(builder, ImmutableList.of(results), ImmutableList.of());
assertThat(toString(builder), containsString("NO TESTS RAN"));
}
use of com.facebook.buck.test.TestCaseSummary in project buck by facebook.
the class TestResultFormatterTest method shouldNotOutputStackTraceStdOutAndStdErrOfFailingTest.
@Test
public void shouldNotOutputStackTraceStdOutAndStdErrOfFailingTest() {
TestResultFormatter formatter = createSilentFormatter();
TestCaseSummary summary = new TestCaseSummary("com.example.FooTest", ImmutableList.of(failingTest));
TestResults results = FakeTestResults.of(ImmutableList.of(summary));
ImmutableList.Builder<String> builder = ImmutableList.builder();
formatter.reportResult(builder, results);
String expected = String.format(Joiner.on('\n').join("FAIL 200ms 0 Passed 0 Skipped 1 Failed com.example.FooTest", "FAILURE %s %s: %s", "%s"), failingTest.getTestCaseName(), failingTest.getTestName(), failingTest.getMessage(), stackTrace);
assertEquals(expected, toString(builder));
}
use of com.facebook.buck.test.TestCaseSummary in project buck by facebook.
the class TestResultFormatterTest method shouldNotOutputLogPathInlineForPassingTest.
@Test
public void shouldNotOutputLogPathInlineForPassingTest() throws IOException {
TestResultFormatter formatter = createFormatterWithMaxLogLines(10);
TestCaseSummary summary = new TestCaseSummary("com.example.FooTest", ImmutableList.of(successTest));
Files.write(logPath, ImmutableList.of("This is a debug log", "Here's another one"), StandardCharsets.UTF_8);
TestResults results = TestResults.builder().setBuildTarget(BuildTargetFactory.newInstance("//foo:bar")).setTestCases(ImmutableList.of(summary)).addTestLogPaths(logPath).build();
ImmutableList.Builder<String> builder = ImmutableList.builder();
formatter.reportResult(builder, results);
assertEquals("PASS 500ms 1 Passed 0 Skipped 0 Failed com.example.FooTest", toString(builder));
}
use of com.facebook.buck.test.TestCaseSummary in project buck by facebook.
the class TestResultFormatterTest method shouldOutputStackTraceStdOutAndStdErrOfFailingTest.
@Test
public void shouldOutputStackTraceStdOutAndStdErrOfFailingTest() {
TestResultFormatter formatter = createNoisyFormatter();
TestCaseSummary summary = new TestCaseSummary("com.example.FooTest", ImmutableList.of(failingTest));
TestResults results = FakeTestResults.of(ImmutableList.of(summary));
ImmutableList.Builder<String> builder = ImmutableList.builder();
formatter.reportResult(builder, results);
String expected = String.format(Joiner.on('\n').join("FAIL 200ms 0 Passed 0 Skipped 1 Failed com.example.FooTest", "FAILURE %s %s: %s", "%s", "====STANDARD OUT====", "%s", "====STANDARD ERR====", "%s"), failingTest.getTestCaseName(), failingTest.getTestName(), failingTest.getMessage(), stackTrace, failingTest.getStdOut(), failingTest.getStdErr());
assertEquals(expected, toString(builder));
}
Aggregations