@Test public void canReadTestExecutionReport() throws Exception { TestExecutionReport original = new TestExecutionReport(); original.version = "version"; original.rootPath = "rootPath"; original.setTotalRunTimeInMillis(totalTimeMeasurementWithElapsedMillis(42)); StringWriter writer = new StringWriter(); original.toXml(writer, VelocityFactory.getVelocityEngine()); ExecutionReport report = ExecutionReport.makeReport(writer.toString()); assertTrue(report instanceof TestExecutionReport); assertEquals(original, report); assertEquals(42, report.getTotalRunTimeInMillis()); }
@Test public void canMakeSuiteExecutionReport() throws Exception { SuiteExecutionReport original = new SuiteExecutionReport(); original.version = "version"; original.rootPath = "rootPath"; original.date = DateTimeUtil.getDateFromString("12/31/1969 18:00:00"); original.finalCounts = new TestSummary(1, 2, 3, 4); original.setTotalRunTimeInMillis(totalTimeMeasurementWithElapsedMillis(41)); long time = DateTimeUtil.getTimeFromString("12/31/1969 18:00:00"); SuiteExecutionReport.PageHistoryReference reference = new SuiteExecutionReport.PageHistoryReference("dah", time, 3L); reference.getTestSummary().wrong = 99; original.addPageHistoryReference(reference); StringWriter writer = new StringWriter(); original.toXml(writer, VelocityFactory.getVelocityEngine()); ExecutionReport report = ExecutionReport.makeReport(writer.toString()); assertTrue(report instanceof SuiteExecutionReport); assertEquals(original, report); assertEquals(41, report.getTotalRunTimeInMillis()); }