com.atlassian.bamboo.build.test.junit
Class JunitTestResultsParser

java.lang.Object
  extended by com.atlassian.bamboo.configuration.DefaultContentHandler
      extended by 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.


Field Summary
 
Fields inherited from class com.atlassian.bamboo.configuration.DefaultContentHandler
DEFAULT_PARSER
 
Constructor Summary
JunitTestResultsParser()
          Known ignored elements are: - properties - property - system-err - system-out - testsuites
 
Method Summary
 Set<TestResults> getFailedTests()
           
 int getNumberOfErrors()
          How many errors did we find in ihe last parsed test report
 int getNumberOfTests()
          How many tests did the last parsed test report contain?
 Set<TestResults> getSkippedTests()
           
 Set<TestResults> getSuccessfulTests()
           
 boolean hasErrors()
           
 void parse(InputStream inputStream)
          Extract unit test results from the given maven test report.
 void startElement(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JunitTestResultsParser

public JunitTestResultsParser()
Known ignored elements are: - properties - property - system-err - system-out - testsuites

Method Detail

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Ignore non existing tags

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultContentHandler
Throws:
SAXException

parse

public void parse(@NotNull
                  InputStream inputStream)
           throws SAXException,
                  IOException
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 XML
IOException - if it has trouble reading the file

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()


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.