Class JunitTestResultsParser
- java.lang.Object
-
- com.atlassian.bamboo.configuration.DefaultContentHandler
-
- com.atlassian.bamboo.build.test.junit.JunitTestResultsParser
-
- All Implemented Interfaces:
ContentHandler
public class JunitTestResultsParser extends DefaultContentHandler
This class extracts the interesting test information from the ant test results.
-
-
Constructor Summary
Constructors Constructor Description JunitTestResultsParser()Known ignored elements are: - properties - property - system-err - system-out - testsuites
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<TestResults>getFailedTests()intgetNumberOfErrors()How many errors did we find in ihe last parsed test reportintgetNumberOfTests()How many tests did the last parsed test report contain?Set<TestResults>getSkippedTests()Set<TestResults>getSuccessfulTests()booleanhasErrors()voidparse(@NotNull InputStream inputStream)Extract unit test results from the given maven test report.voidparse(@NotNull Reader inputReader)voidstartElement(String uri, String localName, String qName, Attributes attributes)Ignore non existing tags-
Methods inherited from class com.atlassian.bamboo.configuration.DefaultContentHandler
characters, endDocument, endElement, endPrefixMapping, hasParserFor, ignorableWhitespace, processingInstruction, registerElementParser, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
-
-
-
-
Method Detail
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
Ignore non existing tags- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultContentHandler- Throws:
SAXException
-
parse
public void parse(@NotNull @NotNull InputStream inputStream) throws SAXException, IOExceptionExtract unit test results from the given maven test report.- Parameters:
inputStream- Maven test report (XML) stream- Throws:
SAXException- if it has trouble parsing the XMLIOException- if it has trouble reading the file
-
parse
public void parse(@NotNull @NotNull Reader inputReader) throws SAXException, IOException- Throws:
SAXExceptionIOException
-
hasErrors
public boolean hasErrors()
-
getNumberOfErrors
public int getNumberOfErrors()
How many errors did we find in ihe last parsed test report- Returns:
- number of errors found
-
getNumberOfTests
public int getNumberOfTests()
How many tests did the last parsed test report contain?- Returns:
- The number of tests
-
getSuccessfulTests
public Set<TestResults> getSuccessfulTests()
-
getFailedTests
public Set<TestResults> getFailedTests()
-
getSkippedTests
public Set<TestResults> getSkippedTests()
-
-