PythonUnitTestResultParser

public class PythonUnitTestResultParser
extends MultiLineReceiver

java.lang.Object
   ↳ com.android.ddmlib.MultiLineReceiver
     ↳ com.android.tradefed.testtype.PythonUnitTestResultParser


Interprets the output of tests run with Python's unittest framework and translates it into calls on a series of ITestRunListeners. Output from these tests follows this EBNF grammar: TestReport ::= TestResult* Line TimeMetric [FailMessage*] Status. TestResult ::= string “(“string”)” “…” SingleStatus. FailMessage ::= EqLine “ERROR:” string “(“string”)” Line Traceback Line. SingleStatus ::= “ok” | “ERROR”. TimeMetric ::= “Ran” integer “tests in” float ”s”. Status ::= “OK” | “FAILED (errors=” int “)”. Traceback ::= string+. Example output: (passing) test_size (test_rangelib.RangeSetTest) ... ok test_str (test_rangelib.RangeSetTest) ... ok test_subtract (test_rangelib.RangeSetTest) ... ok test_to_string_raw (test_rangelib.RangeSetTest) ... ok test_union (test_rangelib.RangeSetTest) ... ok ---------------------------------------------------------------------- Ran 5 tests in 0.002s OK (failed) test_size (test_rangelib.RangeSetTest) ... ERROR ====================================================================== ERROR: test_size (test_rangelib.RangeSetTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_rangelib.py", line 129, in test_rangelib raise ValueError() ValueError ---------------------------------------------------------------------- Ran 1 tests in 0.001s FAILED (errors=1)

Summary

Nested classes

enum PythonUnitTestResultParser.ParserState

Keeps track of the state the parser is currently in. 

Constants

String CASE_OK

String EQLINE

String LINE

String RUN_FAILED

String RUN_OK

Fields

String[] mAllLines

String mCurrentLine

PythonUnitTestResultParser.ParserState mCurrentParseState

TestIdentifier mCurrentTestId

StringBuilder mCurrentTraceback

int mLineNum

long mTotalElapsedTime

int mTotalTestCount

Public constructors

PythonUnitTestResultParser(Collection<ITestRunListener> listeners, String runName)

Public methods

boolean isCancelled()
void processNewLines(String[] lines)

Constants

CASE_OK

String CASE_OK

Constant Value: "ok"

EQLINE

String EQLINE

Constant Value: "======================================================================"

LINE

String LINE

Constant Value: "----------------------------------------------------------------------"

RUN_FAILED

String RUN_FAILED

Constant Value: "FAILED"

RUN_OK

String RUN_OK

Constant Value: "OK"

Fields

mAllLines

String[] mAllLines

mCurrentLine

String mCurrentLine

mCurrentParseState

PythonUnitTestResultParser.ParserState mCurrentParseState

mCurrentTestId

TestIdentifier mCurrentTestId

mCurrentTraceback

StringBuilder mCurrentTraceback

mLineNum

int mLineNum

mTotalElapsedTime

long mTotalElapsedTime

mTotalTestCount

int mTotalTestCount

Public constructors

PythonUnitTestResultParser

PythonUnitTestResultParser (Collection<ITestRunListener> listeners, 
                String runName)

Parameters
listeners Collection
runName String

Public methods

isCancelled

boolean isCancelled ()

Returns
boolean

processNewLines

void processNewLines (String[] lines)

Parameters
lines String