@Override public void write(OutputStream output) throws IOException { new TestResultExport().export(output, testsPerPage, results); } };
@Override protected void writeResult(Row row, int colNum, ITestUnit testUnit) { for (ComparedResult parameter : testUnit.getResultParams()) { boolean okField = parameter.getStatus() == TestStatus.TR_OK; Cell cell = createCell(row, colNum++, parameter.getActualValue(), okField ? styles.resultSuccess : styles.resultFailure); if (!okField) { String expected = "Expected: "; Object expectedValue = getSimpleValue(parameter.getExpectedValue()); if (expectedValue != null) { expected += FormattersManager.format(expectedValue); } setCellComment(cell, expected); } } }
@Override protected void writeResultHeader(TestUnitsResults result, Row row, int colNum) { for (String name : result.getTestResultColumnDisplayNames()) { createCell(row, colNum++, name, styles.header); } }
@Override protected int writeInfo(Sheet sheet, TestUnitsResults result, int rowNum) { TestSuite testSuite = result.getTestSuite(); int failures = result.getNumberOfFailures(); Row row = sheet.createRow(rowNum++); String testName = TableSyntaxNodeUtils.getTestName(testSuite.getTestSuiteMethod()); createCell(row, FIRST_COLUMN, testName, failures > 0 ? styles.testNameFailure : styles.testNameSuccess); row = sheet.createRow(rowNum++); String testInfo = ProjectHelper.getTestInfo(testSuite); if (failures > 0) { testInfo += " (" + failures + " failed)"; } createCell(row, FIRST_COLUMN, testInfo, styles.testInfo); rowNum++; // Skip one row return rowNum; }
@Override public void write(OutputStream output) throws IOException { new TestResultExport().export(output, testsPerPage, results); } };
public void write(TestUnitsResults result) throws Exception { TestSuite testSuite = result.getTestSuite(); String testName = testSuite.getTestSuiteMethod().getName(); String moduleName = testSuite.getTestSuiteMethod().getModuleName(); String suitName = "OpenL." + moduleName + "." + testName; String filename = "TEST-" + suitName + ".xlsx"; if (!dir.mkdirs() && !dir.exists()) { throw new IOException("Can't create folder '" + dir.getAbsolutePath() + "'."); } File file = new File(dir, filename); try (FileOutputStream outputStream = new FileOutputStream(file)) { new TestResultExport().export(outputStream, -1, result); } } }
public void write(TestUnitsResults result) throws Exception { TestSuite testSuite = result.getTestSuite(); String testName = testSuite.getTestSuiteMethod().getName(); String moduleName = testSuite.getTestSuiteMethod().getModuleName(); String suitName = "OpenL." + moduleName + "." + testName; String filename = "TEST-" + suitName + ".xlsx"; if (!dir.mkdirs() && !dir.exists()) { throw new IOException("Can't create folder '" + dir.getAbsolutePath() + "'."); } File file = new File(dir, filename); try (FileOutputStream outputStream = new FileOutputStream(file)) { new TestResultExport().export(outputStream, -1, result); } } }