public class XMLResultAggregator extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DIR
The default directory: ..
|
static String |
DEFAULT_FILENAME
the default file name: TESTS-TestSuites.xml.
|
Constructor and Description |
---|
XMLResultAggregator() |
Modifier and Type | Method and Description |
---|---|
protected void |
addTestSuite(Element root,
Element testsuite)
Add a new testsuite node to the document.
|
protected Element |
createDocument()
Create a DOM tree.
|
void |
execute()
Aggregate all testsuites into a single document and write it to the
specified directory and file.
|
protected File |
getDestinationFile()
Get the full destination file where to write the result.
|
protected File[] |
getFiles()
Get all
.xml files in the fileset. |
static void |
main(String[] args) |
void |
setInputFolder(String folder) |
void |
setOutputFilename(String name) |
void |
setTodir(File value)
Set the destination directory where the results should be written.
|
void |
setTofile(String value)
Set the name of the aggregegated results file.
|
protected void |
writeDOMTree(Document doc,
File file)
Write the DOM tree to a file.
|
public static final String DEFAULT_DIR
public static final String DEFAULT_FILENAME
public void setInputFolder(String folder)
public void setOutputFilename(String name)
public void setTofile(String value)
DEFAULT_FILENAME
.value
- the name of the file.setTodir(File)
public void setTodir(File value)
DEFAULT_DIR
. When given a relative directory
it will resolve it from the project directory.value
- the directory where to write the results, absolute or
relative.public void execute()
protected File getDestinationFile()
protected File[] getFiles()
.xml
files in the fileset.protected void writeDOMTree(Document doc, File file) throws IOException
doc
- the XML document to dump to disk.file
- the filename to write the document to. Should obviouslly be a .xml file.IOException
- thrown if there is an error while writing the content.protected Element createDocument()
Create a DOM tree. Has 'testsuites' as firstchild and aggregates all testsuite results that exists in the base directory.
protected void addTestSuite(Element root, Element testsuite)
Add a new testsuite node to the document. The main difference is that it split the previous fully qualified name into a package and a name.
For example: org.apache.Whatever will be split into org.apache and Whatever.
root
- the root element to which the testsuite node should
be appended.testsuite
- the element to append to the given root. It will slightly
modify the original node to change the name attribute and add
a package one.public static void main(String[] args)
Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries