private <T> void writeTestCasesForClass(Class<T> classType) throws IOException, SecurityException { String className = classType.getCanonicalName(); html.h2().a(id(className)).write("Test Class: " + className)._a()._h2(); html.ul(); for (Method method : classType.getDeclaredMethods()) { if (method.isAnnotationPresent(Test.class)) { writeTestCaseDetails(method, className); } } html._ul(); toTop(); }
private void generatePiechart(HtmlCanvas reportPageBody, IRunTestResults iRunTestResults) throws IOException { HtmlCanvas divSummary = reportPageBody.div(); divSummary.div(new HtmlAttributes().id(PIECHART_ID))._div(); HtmlCanvas divTestSummary = divSummary.div(new HtmlAttributes().class_(TEST_SUMMARY_CLASS)); int passedCount = iRunTestResults.getPassedTests().size(); int skippedCount = iRunTestResults.getSkippedTests().size(); int failedCount = iRunTestResults.getFailedTests().size(); divTestSummary.h2().content(format(PASSED_TESTS, passedCount)); divTestSummary.h2().content(format(FAILED_TESTS, failedCount)); divTestSummary.h2().content(format(SKIPPED_TESTS, skippedCount)); divTestSummary._div(); divSummary._div(); // Hidden divs used to be able to link data to piechart.js reportPageBody.div(new HtmlAttributes().id(PASSED.toLowerCase(ENGLISH)) .class_(HIDDEN_CLASS)).content(passedCount); reportPageBody.div(new HtmlAttributes().id(FAILED.toLowerCase(ENGLISH)) .class_(HIDDEN_CLASS)).content(failedCount); reportPageBody.div(new HtmlAttributes().id(SKIPPED.toLowerCase(ENGLISH)) .class_(HIDDEN_CLASS)).content(skippedCount); }
private HtmlCanvas getArchetypeSection() throws IOException { HtmlCanvas html = new HtmlCanvas(); html.div(class_("section")). div(class_("page-header")). h2(id("Archetype")).em().write(project.getArtifactId())._em().write(" archetype")._h2() ._div(). a(name("Archetype"))._a(); String additionalHTML = replaceProperties(getPropertyValue(project, "archetypeAdditionalHTML", false, false, false)); if (additionalHTML != null && ! additionalHTML.isEmpty()) { html.write(additionalHTML, false); } Dependency dependency = new Dependency(); dependency.setGroupId(project.getGroupId()); dependency.setArtifactId(project.getArtifactId()); dependency.setVersion(project.getVersion()); String archetypeAdditionalArguments = replaceProperties(project.getProperties().getProperty("archetypeAdditionalArguments")); HtmlCanvas commandLine = createArchetypesCommandLines(dependency, archetypeAdditionalArguments, false); html.write(commandLine.toHtml(), false) ._div(); return html; }
@SuppressWarnings("unchecked") protected void writeSummary() throws IOException { html.h2(id("tobeapproved")).content("Test Cases Ready for Approval"); html.h2(id("needCode")).content("Test Cases Yet to be Implemented"); if (needCode.size() == 0) html.b().write("No test cases that need to be Implemented")._b() html.h2().a(id("indirectCases")).content("Test Cases Covered Indirectly")._h2(); writeIndirectCases(); html.h2().content("Implemented Test Classes"); html.h2().a(id("manualTests")) .content("Tests that Must be Tested Manually")._h2(); generateList(manuals); html.h2().a(id("clientTests")).content("Client-Based Test Cases")._h2(); generateList(clients);
private void generateList(String[] list, String title) throws IOException { html.h2().write(title)._h2(); if (list.length == 0) { html.div(style("padding-left:2em")).i() .content("No groups of this type found in the test suite") ._div(); } else { html.ul(); for (String group : list) { html.li().content(group); } html._ul(); } }
private String buildHtml() { HtmlCanvas html = new HtmlCanvas(); try { HtmlCanvas tmp = html .head() .title() .content("StreamPipes Connector Master Container") ._head() .body() .h1().write("Connector Master Container")._h1() .h2().write("All Running Adapters")._h2() .ol(); tmp = getAllRunningAdapters(tmp); html = tmp._ol() ._body(); } catch (IOException e) { logger.error("Error in SP Connect Master Container: ", e); } return html.toHtml(); }
/** * Add the table to the HTML canvas ready for rendering * * @param html html canvas * @param tableRows table rows, these should all be the same lenght * @param headers table headers * @param title itle of the table * @throws IOException if IO error occurs */ public void addTable(HtmlCanvas html, List<TableRow> tableRows, List<String> headers, String title) throws IOException { html.h2().content(title); html.table(); html.tr(); for (String header : headers) { html.th().content(header); } html._tr(); int i = 0; for (TableRow row : tableRows) { String clazz = (i % 2 == 0) ? "even" : "odd"; html.tr(class_(clazz)); for (String column : row.getCells()) { html.td().content(column); } html._tr(); i++; } html._table(); }
div(class_("section")). div(class_("page-header")). h2().write("Changelog")._h2() ._div();
@Override public HtmlCanvas getContent(HtmlCanvas html) throws IOException, SAXException { html. div(class_("row")). div(class_("span12")). div(class_("body-content")). div(class_("section")). div(class_("page-header")). h2(id(packagingName + "-packaging")).write(packagingName + " packaging")._h2(). p().write("This is the packaging for " + packagingName + ".")._p() ._div() ._div() ._div() ._div() ._div(); return html; } };
private HtmlCanvas getLifecyclesDocumentation(HtmlCanvas html) throws IOException { html. div(class_("row")). div(class_("span12")). div(class_("body-content")). div(class_("section")). div(class_("page-header")). h2(id("Lifecycles")).write("Lifecycles")._h2(). p().write("The different lifecycles of the plugin are associated with custom packagings.")._p(); html.render(new Renderable() { @Override public void renderOn(HtmlCanvas html) throws IOException { getLifecyclesSection(html); } }); html ._div() ._div() ._div() ._div() ._div(); return html; }
private HtmlCanvas generateGlobalDocumentation(HtmlCanvas html) throws IOException { html. div(class_("row")). div(class_("span12")). div(class_("body-content")). div(class_("section")). div(class_("page-header")). h2(id("Global_Documentation")).write("Global Documentation")._h2(). p().write("The global documentation describes parameters which are common to a group of projects.")._p(); html.render(new Renderable() { @Override public void renderOn(HtmlCanvas html) throws IOException { generateGlobalParametersSection(html); } }); html.render(new Renderable() { @Override public void renderOn(HtmlCanvas html) throws IOException { generateSampleProfileDocumentation(html); } }); html ._div() ._div() ._div() ._div() ._div(); return html; }
private void generateDetail(IResultMap tests) throws IOException { for (ITestResult m : tests.getAllResults()) { ITestNGMethod method = m.getMethod(); String normalizedName = AbstractEarlReporter.createTestCaseName( m.getTestClass().getName(), method.getMethodName()); html.h2() .a(id(m.getTestClass().getName() + "_" + method.getMethodName())) .write(normalizedName)._a()._h2(); getAdditionalInfo(m, method); html.p(class_("indented")) .b() .write("Description: ") ._b() .write((method.getDescription() != null ? method .getDescription() : "No description for this test method found")) ._p(); String groups = ""; for (String group : method.getGroups()) { groups += group + " "; } html.p(class_("indented")).b().write("Requirement Level: ")._b() .write(groups)._p(); toTop(); } }
skipClasses = getClasses(skippedTests); html.h2().content("Overall Coverage Bar Charts");
protected void createSummaryReport() throws IOException { html.h2().content("Summary of Test Methods"); html.table(class_("summary")); html.tr().th().content("Totals");