/** * A test runner can generate reports via Reporter instances that subscribe * to the test runner. The test runner tells the reporter what directory to * place the reports in. Then, at the end of the test, the test runner * notifies these reporters of the test outcomes. The reporter's job is to * process each test run outcome and do whatever is appropriate. * * @param testOutcomeResults the test results from the previous test run. */ private void generateReportsFor(final List<TestOutcome> testOutcomeResults) { getReportService().generateReportsFor(testOutcomeResults); }
public static ReportService getReportService(Configuration systemConfiguration) { return new ReportService(systemConfiguration.getOutputDirectory(), ReportService.getDefaultReporters()); }
/** * A test runner can generate reports via Reporter instances that subscribe * to the test runner. The test runner tells the reporter what directory to * place the reports in. Then, at the end of the test, the test runner * notifies these reporters of the test outcomes. The reporter's job is to * process each test run outcome and do whatever is appropriate. * * @param testOutcomeResults A list of test outcomes to use in report generation. * These may be stored in memory (e.g. by a Listener instance) or read from the XML * test results. */ public void generateReportsFor(final List<TestOutcome> testOutcomeResults) { final TestOutcomes allTestOutcomes = TestOutcomes.of(testOutcomeResults); for (final AcceptanceTestReporter reporter : getSubscribedReporters()) { generateReportsFor(reporter, allTestOutcomes); } for (final AcceptanceTestFullReporter reporter : getSubscribedFullReporters()) { generateFullReportFor(allTestOutcomes, reporter); } }
public void generateReports() { reportService.generateReportsFor(latestTestOutcomes()); reportService.generateConfigurationsReport(); }
/** * A test runner can generate reports via Reporter instances that subscribe * to the test runner. The test runner tells the reporter what directory to * place the reports in. Then, at the end of the test, the test runner * notifies these reporters of the test outcomes. The reporter's job is to * process each test run outcome and do whatever is appropriate. * * @param testOutcomeResults A list of test outcomes to use in report generation. * These may be stored in memory (e.g. by a Listener instance) or read from the XML * test results. */ public void generateReportsFor(final List<TestOutcome> testOutcomeResults) { final TestOutcomes allTestOutcomes = TestOutcomes.of(testOutcomeResults); for (final AcceptanceTestReporter reporter : getSubscribedReporters()) { generateReportsFor(reporter, allTestOutcomes); } }
/** * The default reporters applicable for standard test runs. */ protected Collection<AcceptanceTestReporter> getDefaultReporters() { return ReportService.getDefaultReporters(); }
private void generateReportsFor(final AcceptanceTestReporter reporter, final TestOutcomes testOutcomes) { LOGGER.debug("Generating reports for " + testOutcomes.getTotalTestScenarios() + " test outcomes using: " + reporter); long t0 = System.currentTimeMillis(); List<? extends TestOutcome> outcomes = testOutcomes.getOutcomes(); ExecutorService executorService = Executors.newFixedThreadPool(maximumPoolSize); try { final ArrayList<Future> tasks = new ArrayList<>(outcomes.size()); for (final TestOutcome outcome : outcomes) { tasks.add(executorService.submit(() -> { LOGGER.debug("Processing test outcome " + outcome.getCompleteName()); generateReportFor(outcome, reporter); LOGGER.debug("Processing test outcome " + outcome.getCompleteName() + " done"); })); } generateJUnitTestResults(testOutcomes); waitForReportGenerationToFinish(tasks); } finally { LOGGER.debug("Shutting down executor service"); executorService.shutdown(); } LOGGER.debug("Reports generated in: " + (System.currentTimeMillis() - t0) + " ms"); }
/** * Reports are generated using the test results in a given directory. * The actual reports are generated using a set of reporter objects. The report service passes test outcomes * to the reporter objects, which generate different types of reports. * * @param outputDirectory Where the test data is stored, and where the generated reports will go. * @param subscribedReporters A set of reporters that generate the actual reports. */ public ReportService(final File outputDirectory, final Collection<AcceptanceTestReporter> subscribedReporters) { this.outputDirectory = outputDirectory; getSubscribedReporters().addAll(subscribedReporters); }
generateJUnitTestResults(testOutcomes); waitForReportGenerationToFinish(remainingReportCount); LOGGER.info("Reports generated in: " + (System.currentTimeMillis() - t0));
private ReportService getReportService() { if (reportService == null) { reportService = new ReportService(getOutputDirectory(), getDefaultReporters()); } return reportService; }
/** * Reports are generated using the test results in a given directory. * The actual reports are generated using a set of reporter objects. The report service passes test outcomes * to the reporter objects, which generate different types of reports. * * @param outputDirectory Where the test data is stored, and where the generated reports will go. * @param subscribedReporters A set of reporters that generate the actual reports. */ public ReportService(final File outputDirectory, final Collection<AcceptanceTestReporter> subscribedReporters, final Collection<AcceptanceTestFullReporter> subscribedFullReporters, final EnvironmentVariables environmentVariables) { this.outputDirectory = outputDirectory; if (!this.outputDirectory.exists()) { this.outputDirectory.mkdirs(); } getSubscribedReporters().addAll(subscribedReporters); getSubscribedFullReporters().addAll(subscribedFullReporters); jUnitXMLOutcomeReporter = new JUnitXMLOutcomeReporter(outputDirectory); this.maximumPoolSize = ThucydidesSystemProperty.REPORT_MAX_THREADS.integerFrom(environmentVariables, Runtime.getRuntime().availableProcessors()); }
waitForReportGenerationToFinish(remainingReportCount); LOGGER.info("Reports generated in: " + (System.currentTimeMillis() - t0) );
private void generateQueuedReport(ListenableFuture<TestOutcome> future, TestOutcomes testOutcomes, AcceptanceTestReporter reporter) { try { final TestOutcome outcome = future.get(); LOGGER.info("Processing test outcome " + outcome.getCompleteName()); generateReportFor(outcome, testOutcomes, reporter); } catch (InterruptedException e) { throw new RuntimeException("Report generation failure", e); } catch (ExecutionException e) { throw new RuntimeException("Report generation failure", e); } }
/** * A test runner can generate reports via Reporter instances that subscribe * to the test runner. The test runner tells the reporter what directory to * place the reports in. Then, at the end of the test, the test runner * notifies these reporters of the test outcomes. The reporter's job is to * process each test run outcome and do whatever is appropriate. * * @param testOutcomeResults A list of test outcomes to use in report generation. * These may be stored in memory (e.g. by a Listener instance) or read from the XML * test results. */ public void generateReportsFor(final List<TestOutcome> testOutcomeResults) { final TestOutcomes allTestOutcomes = TestOutcomes.of(testOutcomeResults); for (final AcceptanceTestReporter reporter : getSubscribedReporters()) { generateReportsFor(reporter, allTestOutcomes); } }
private Collection<AcceptanceTestReporter> getDefaultReporters() { return ReportService.getDefaultReporters(); }
public void subscribe(final AcceptanceTestReporter reporter) { getSubscribedReporters().add(reporter); }
private ReportService getReportService() { if (reportService == null) { reportService = new ReportService(getOutputDirectory(), getDefaultReporters()); } return reportService; }
private void generateReportsFor(List<TestOutcome> testOutcomes) { getReportService().generateReportsFor(testOutcomes); }
public static ReportService getReportService(Configuration systemConfiguration) { return new ReportService(systemConfiguration.getOutputDirectory(), ReportService.getDefaultReporters()); }
@Inject public ReportService(final Configuration configuration) { this(configuration.getOutputDirectory(), getDefaultReporters()); }