Author: jdillon Date: Mon Feb 5 19:19:28 2007 New Revision: 503967 URL: http://svn.apache.org/viewvc?view=rev&rev=503967 Log: Changes testcase to detail to generate into .html Adding crude support for package and class summaries Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl (with props) geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl (with props) Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy?view=diff&rev=503967&r1=503966&r2=503967 ============================================================================== --- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy (original) +++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy Mon Feb 5 19:19:28 2007 @@ -67,6 +67,12 @@ return props } + def makeSafeFilename(String filename) { + assert filename + + return filename.replace('.', '/').replace('#', '_') + } + def generate() { ant.mkdir(dir: targetDir) @@ -79,18 +85,11 @@ // Setup the template engine def engine = new TemplateEngine('gbuild/config/projects/Geronimo_CTS/report/resources') - // Process each result archive - archives.each { archive -> - log.info "Processing results archive: $archive" - - // Unpack the results - ant.unzip(src: archive, dest: workDir) - - // Load runtests.properties, so we can see webcontainer and iteration (and others) - def props = loadProperties("$workDir/runtests.properties") + def loadTestSuite = { dir -> + log.info "Loading testsuite from: $dir" def scanner = ant.fileScanner { - fileset(dir: workDir) { + fileset(dir: dir) { include(name: '**/*.jtr') } } @@ -111,22 +110,21 @@ log.info "Testsuite loaded in $watch" - // - // TODO: Collect all packages, classes, tests - // - - // - // TODO: Collect global stats (passed, failed, errors, time) - // - - // - // TODO: May want to add some sanity checks to make sure that iterations - // do not have weird matching of stats for packages? - // - - // - // TODO: First thing is to generate the test detail pages - // + return testSuite + } + + // Process each result archive + archives.each { archive -> + log.info "Processing results archive: $archive" + + // Unpack the results + ant.unzip(src: archive, dest: workDir) + + // Load runtests.properties, so we can see webcontainer and iteration (and others) + def props = loadProperties("$workDir/runtests.properties") + + // Load the testuite + def testSuite = loadTestSuite(workDir) def renderTestCase = { testCase -> log.info "Processing testcase: $testCase.name" @@ -134,14 +132,61 @@ def template = engine.getTemplate('testcase.tmpl') template.params.testCase = testCase - def file = new File(targetDir, testCase.name.replace('.', '/').replace('#', '_') + '.html') + def file = new File(targetDir, makeSafeFilename(testCase.className) + '/' + testCase.testName + '.html') ant.mkdir(dir: file.parentFile) template.render(file) } + def testsInClasses = [:] + def classesInPackages = [:] + testSuite.testCases.each { name, testCase -> renderTestCase(testCase) + + def list + + list = testsInClasses[testCase.className] + if (!list) { + list = new HashSet() + testsInClasses[testCase.className] = list + } + list << testCase.name + + list = classesInPackages[testCase.packageName] + if (!list) { + list = new HashSet() + classesInPackages[testCase.packageName] = list + } + list << testCase.className + } + + // Render class summaries + testsInClasses.each { className, testNames -> + log.info "Processing class summary: $className" + + def template = engine.getTemplate('class-summary.tmpl') + template.params.className = className + template.params.testNames = testNames + + def file = new File(targetDir, makeSafeFilename(className) + '/index.html') + ant.mkdir(dir: file.parentFile) + + template.render(file) + } + + // Render package summaries + classesInPackages.each { packageName, classNames -> + log.info "Processing package summary: $packageName" + + def template = engine.getTemplate('package-summary.tmpl') + template.params.packageName = packageName + template.params.classNames = classNames + + def file = new File(targetDir, makeSafeFilename(packageName) + '/index.html') + ant.mkdir(dir: file.parentFile) + + template.render(file) } // Clean up Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl?view=auto&rev=503967 ============================================================================== --- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl (added) +++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl Mon Feb 5 19:19:28 2007 @@ -0,0 +1,43 @@ +<% +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// +// $Id$ +// +%> + + + $className + + +
+

$className

+ + + <% for (testName in testNames) { %> + + <% def basename = testName.substring(testName.lastIndexOf('#') + 1, testName.size()) %> + + + <% } %> +
$testName
+
+ + Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/class-summary.tmpl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl?view=auto&rev=503967 ============================================================================== --- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl (added) +++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl Mon Feb 5 19:19:28 2007 @@ -0,0 +1,43 @@ +<% +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// +// $Id$ +// +%> + + + $packageName + + +
+

$packageName

+ + + <% for (className in classNames) { %> + + <% def basename = className.substring(className.lastIndexOf('.') + 1, className.size()) %> + + + <% } %> +
$className
+
+ + Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-summary.tmpl ------------------------------------------------------------------------------ svn:mime-type = text/plain