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 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; }
private void makeIndirectSummaryTable() throws IOException { html.table(class_("indented")); html.tr().th().a(id(("Indirect"))).write("Indirectly Tested Test Cases")._a()._th(); html.th().content("Overall Test Result"); html.th().content("Description of Test Method")._tr();
@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().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 HtmlCanvas generateSampleProfileDocumentation(HtmlCanvas html) throws IOException { HtmlCanvas sampleProfile = new HtmlCanvas(); sampleProfile = generateSampleProfile(sampleProfile); html. div(class_("section")). h3(id("Sample_Profile")).write("Sample Profile")._h3(). p().em().write("Based on above properties, here is a sample profile to include in ").a(href("https://maven.apache.org/settings.html")).write("Maven settings.xml file")._a().write(":")._em()._p(). write(sampleProfile.toHtml(), false). write(sampleProfileCommandLineGenerator, false) ._div(); addPropertyInSessionRequest("sampleProfile", sampleProfile.toHtml()); return html; }
private void makeMethodSummaryTable(IResultMap tests, String title) throws IOException { html.table(class_("indented")); html.tr().th(class_(title)).a(id((title))).write(title + " Test Cases")._a()._th(); html.th(class_(title)).content("Groups"); html.th(class_(title)).content("Description of Test Method")._tr();
@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 HtmlCanvas generateGlobalParametersSection(HtmlCanvas html) throws IOException { html. div(class_("section")). h3(id("Global_Parameters")).write("Global Parameters")._h3(). p().em().write("By default, only parameters which cannot be guessed are displayed. ")._em(). a(href("#").id("toggleGuessed")).write("Show other parameters")._a().write(" to customize default values.")._p();
@Override public void renderOn(HtmlCanvas html) throws IOException { html. div(class_("section")). h3(id("Lifecycle_"+this.getPackagingName())).a(href("packaging-"+this.getPackagingName()+".html")).write(this.getPackagingName())._a()._h3(). table(border("0").class_("bodyTable table table-striped table-hover")). thead(). tr(class_("a")). th().write("Phase")._th(). th().write("Goal")._th(). _tr() ._thead(). tbody(); for (t3.LifecyclesUtils.Phase phase : this.getPhases()) { ((Phase) phase).renderOn(html); } html ._tbody() ._table() ._div(); }
td(). b(). a(id(name).href("#"+name)).write(property)._a() ._b() ._td().
@Override public void renderOn(HtmlCanvas html) throws IOException { html .render(DocType.HTML5) .html(lang("en")) .head() .meta(charset("utf8")) .meta(name("viewport").content("width=device-width, initial-scale=1.0")) .title().content("GumTree") .macros().javascript("/dist/jquery.min.js") .macros().javascript("/dist/codemirror.min.js") .macros().stylesheet("/dist/codemirror.css") .macros().javascript("/dist/mergely.min.js") .macros().javascript("/dist/mergely_shortcuts.js") .macros().stylesheet("/dist/mergely.css") .macros().stylesheet("/dist/mergely_custom.css") ._head() .body() .div(id("compare")) ._div() .macros().script("lhs_url = \"/left/" + id + "\";") .macros().script("rhs_url = \"/right/" + id + "\";") .macros().javascript("/dist/mergely_ajax.js") ._body() ._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(); } }
@Override public void renderOn(HtmlCanvas html) throws IOException { html .render(DocType.HTML5) .html(lang("en")) .head() .meta(charset("utf8")) .meta(name("viewport").content("width=device-width, initial-scale=1.0")) .title().content("GumTree") .macros().javascript("/dist/jquery.min.js") .macros().javascript("/dist/codemirror.min.js") .macros().stylesheet("/dist/codemirror.css") .macros().javascript("/dist/mergely.min.js") .macros().javascript("/dist/mergely_shortcuts.js") .macros().stylesheet("/dist/mergely.css") .macros().stylesheet("/dist/mergely_custom.css") ._head() .body() .div(id("compare")) ._div() .macros().script("lhs_url = \"/left/" + id + "\";") .macros().script("rhs_url = \"/right/" + id + "\";") .macros().javascript("/dist/mergely_ajax.js") ._body() ._html(); } }