use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testShouldPrintCachedStatus.
@Test
public void testShouldPrintCachedStatus() throws Exception {
String expectedString = ANY_STRING + "\\(cached" + ANY_STRING;
AnsiTerminalPrinter terminalPrinter = Mockito.mock(AnsiTerminalPrinter.class);
TestSummary summary = createTestSummary(stubTarget, BlazeTestStatus.PASSED, CACHED);
TestSummaryPrinter.print(summary, terminalPrinter, true, false);
terminalPrinter.print(find(expectedString));
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testCollectingFailedDetails.
@Test
public void testCollectingFailedDetails() throws Exception {
TestCase rootCase = TestCase.newBuilder().setName("tests").setRunDurationMillis(5000L).addChild(newDetail("apple", TestCase.Status.FAILED, 1000L)).addChild(newDetail("banana", TestCase.Status.PASSED, 1000L)).addChild(newDetail("cherry", TestCase.Status.ERROR, 1000L)).build();
TestSummary summary = getTemplateBuilder().collectFailedTests(rootCase).setStatus(BlazeTestStatus.FAILED).build();
AnsiTerminalPrinter printer = Mockito.mock(AnsiTerminalPrinter.class);
TestSummaryPrinter.print(summary, printer, true, true);
verify(printer).print(contains("//package:name"));
verify(printer).print(find("FAILED.*apple"));
verify(printer).print(find("ERROR.*cherry"));
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testNumberOfFailedRuns.
@Test
public void testNumberOfFailedRuns() throws Exception {
String expectedString = ANY_STRING + "ERROR" + ANY_STRING + BlazeTestStatus.FAILED + ANY_STRING + "in 2 out of 3";
AnsiTerminalPrinter terminalPrinter = Mockito.mock(AnsiTerminalPrinter.class);
TestSummary summary = basicBuilder.setStatus(BlazeTestStatus.FAILED).addPassedLogs(getPathList("/a")).addFailedLogs(getPathList("/b", "/c")).build();
TestSummaryPrinter.print(summary, terminalPrinter, true, false);
terminalPrinter.print(find(expectedString));
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testCoverageDataReferences.
@Test
public void testCoverageDataReferences() throws Exception {
List<Path> paths = getPathList("/cov1.dat", "/cov2.dat", "/cov3.dat", "/cov4.dat");
FileSystemUtils.writeContentAsLatin1(paths.get(1), "something");
FileSystemUtils.writeContentAsLatin1(paths.get(3), "");
FileSystemUtils.writeContentAsLatin1(paths.get(3), "something else");
TestSummary summary = basicBuilder.addCoverageFiles(paths).build();
AnsiTerminalPrinter terminalPrinter = Mockito.mock(AnsiTerminalPrinter.class);
TestSummaryPrinter.print(summary, terminalPrinter, true, false);
verify(terminalPrinter).print(find(ANY_STRING + "INFO" + ANY_STRING + BlazeTestStatus.PASSED));
verify(terminalPrinter).print(find(" /cov2.dat"));
verify(terminalPrinter).print(find(" /cov4.dat"));
}
use of com.google.devtools.build.lib.util.io.AnsiTerminalPrinter in project bazel by bazelbuild.
the class TestSummaryTest method testNoTime.
@Test
public void testNoTime() throws Exception {
// The last part matches anything not containing "in".
String expectedString = ANY_STRING + "INFO" + ANY_STRING + BlazeTestStatus.PASSED + "(?!in)*";
AnsiTerminalPrinter terminalPrinter = Mockito.mock(AnsiTerminalPrinter.class);
TestSummary summary = basicBuilder.addTestTimes(ImmutableList.of(3412L)).build();
TestSummaryPrinter.print(summary, terminalPrinter, false, false);
terminalPrinter.print(find(expectedString));
}
Aggregations