Ejemplo n.º 1
0
 @Test
 public void properNewlines() {
   final OutputValidator outputValidator =
       unpack("/consoleOutput").redirectToFile(true).setJUnitVersion("4.7").executeTest();
   TestFile surefireReportsFile =
       outputValidator.getSurefireReportsFile("consoleOutput.Test1-output.txt");
   surefireReportsFile.assertContainsText("SoutAgain");
   surefireReportsFile.assertContainsText("Printline in shutdown hook");
 }
  @Test
  public void testReportWithAggregate() throws Exception {

    SurefireLauncher surefireLauncher = unpack().failNever();
    surefireLauncher.executeTest();
    surefireLauncher.addGoal("-Daggregate=true");
    OutputValidator validator = surefireLauncher.executeSurefireReport();
    TestFile siteFile = validator.getSiteFile("surefire-report.html");
    siteFile.assertContainsText("MyModule1ClassTest");
    siteFile.assertContainsText("MyModule2ClassTest");
    siteFile.assertContainsText("MyDummyClassM1Test");
  }
 @Test
 public void testBuildFailingWhenErrors() {
   OutputValidator outputValidator =
       unpack("/surefire-500-puzzling-error").failNever().executeTest();
   TestFile surefireReportsFile =
       outputValidator.getSurefireReportsFile("surefire500.ExplodingTest.txt");
   surefireReportsFile.assertContainsText("java.lang.NoClassDefFoundError: whoops!");
 }
 @Test
 public void testReportWithoutAggregate() throws Exception {
   SurefireLauncher surefireLauncher = unpack().failNever();
   surefireLauncher.executeTest();
   surefireLauncher.reset();
   surefireLauncher.executeSurefireReport();
   OutputValidator module1 = surefireLauncher.getSubProjectValidator("module1");
   TestFile siteFile = module1.getSiteFile("surefire-report.html");
   siteFile.assertContainsText("MyModule1ClassTest");
   siteFile.assertContainsText("MyDummyClassM1Test");
 }