-
Notifications
You must be signed in to change notification settings - Fork 6
/
TEST_REPORT.adoc.jam
52 lines (44 loc) · 2.19 KB
/
TEST_REPORT.adoc.jam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
= Jamal Compilation Test Report
This document is a demonstration of how you can use Jamal to generate a report from a set of XML files.
The macros list all the XML files created by the test suite.
Then for each file, it extracts the test cases and their execution time.
Finally, it computes the total execution time for all the test cases.
You can have a look at the generated final AsciiDoc file, but it is not too informative.
The test-suite-generated XML files do not contain too much information about the test execution.
If you want a better and really meaningful, you have to use the output of a special TestSiteListener.
Currently, there is no such reporting, but it is developing in the Junit Pioneer project.
{%#define xmlFiles={%@listDir (format="$name" separator="," pattern=".*TEST-javax0.*\\.xml$")
./jamal-test/target/surefire-reports
%}%}
{%@define timeFullTotal=0%}
{%!@for [evalist] testFile in (xmlFiles)=
// define the macro file containing the structured XML content of the file
// 'testFile' is the name of the file, replaced by the 'for' loop execution
{%@snip:xml file=testFile%}
// the title of the section is the name of the file without path
== {%@file (format="$simpleName") testFile%}
// then we have the full path of the file except the system-specific part (none of your business :-)
__{%#replace (regex) |{%@file (format="$parent") testFile%}|.*/jamal/|./|%}__
// execute a little BASIC-formatted code for each XML
{%@do float
timeTotal=0
' Go through the test cases from 1 to the number of test cases
' Use the XPath to get the data from the XML
for i=1 to file("count(/testsuite/testcase)")
' get the path of the test case
path = "/testsuite/testcase["+i+"]"
' get the data from the XML using XPath
class = file(path+"/@classname" )
name = file(path+"/@name" )
time = file(path+"/@time" )
' accumulate the time for the current test case
timeTotal = timeTotal + time
' accumulate the time for all the test cases
timeFullTotal = timeFullTotal + time
' output the test case class, name and time
<< "* `" + class + "::" + name + " " + time + "sec`\n"
next
<< "* `Total: " + timeTotal + "sec`\n"
%}
%}
Total Test Time: `{%timeFullTotal%}sec`