Class JunitTestResultsParser
java.lang.Object
com.atlassian.bamboo.configuration.DefaultContentHandler
com.atlassian.bamboo.build.test.junit.JunitTestResultsParser
- All Implemented Interfaces:
ContentHandler
This class extracts the interesting test information from the ant test results.
-
Constructor Summary
ConstructorDescriptionKnown ignored elements are: - properties - property - system-err - system-out - testsuites -
Method Summary
Modifier and TypeMethodDescriptionint
How many errors did we find in ihe last parsed test reportint
How many tests did the last parsed test report contain?boolean
void
parse
(@NotNull InputStream inputStream) Extract unit test results from the given maven test report.void
void
startElement
(String uri, String localName, String qName, Attributes attributes) Ignore non existing tagsMethods inherited from class com.atlassian.bamboo.configuration.DefaultContentHandler
characters, endDocument, endElement, endPrefixMapping, hasParserFor, ignorableWhitespace, processingInstruction, registerElementParser, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
JunitTestResultsParser
public JunitTestResultsParser()Known ignored elements are: - properties - property - system-err - system-out - testsuites
-
-
Method Details
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException Ignore non existing tags- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultContentHandler
- Throws:
SAXException
-
parse
Extract 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
- Throws:
SAXException
IOException
-
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
-
getFailedTests
-
getSkippedTests
-