Class org.as2lib.test.unit.TestRunner

org.as2lib.app.exec.AbstractProcess
   +--org.as2lib.test.unit.TestRunner

Implemented Interfaces

Process

Description

Central TestSystem Class to run Testcases and TestSuites. This is the heart of the TestSystem. All Tests get executed here. It contains a execution service for TestSuites and TestCase.

To use the TestRunner you simple have to instanciate it and run some TestCase to it. Example: import org.as2lib.test.unit.TestRunner; import org.as2lib.test.unit.LoggerTestListener; var testRunner:TestRunner = new TestRunner(); testRunner.addProcessListener(new LoggerTestListener()); testRunner.run(new MyTestCase()); // alternativly you have a faster .runTestCase

You can get the result of the running testcase(s) by @see #getTestResult. It contains all Informations about the resulted testcases.

The Testrunner is designed as process so its possible to add Listener to the TestRunner by addProcessListener. In this way it is possible to build a graphical view to the TestRunner (TestRunner is the Controller and TestResult the Model -> MVC).

Note: There is currently no better abstraction Level Possible so we have to differ between TestCase & TestSuite. The current implementation of .run allows only those two classes.

Field Index

FRAMES_UNTIL_RESUME, MAX_TIME_UNTIL_AUTO_PAUSE

Method Index

new TestRunner()

getCurrentTestCase(), getCurrentTestCaseMethodInfo(), getPercentage(), getTestResult(), isTestCaseMethodFinished(), pause(), resume(), run(), start()

Inherited from AbstractProcess

addAllProcessListeners(), addProcessListener(), getAllProcessListeners(), getParentProcess(), hasFinished(), hasStarted(), isPaused(), isRunning(), onFinishProcess(), onPauseProcess(), onProcessError(), onResumeProcess(), onStartProcess(), onUpdateProcess(), removeAllProcessListeners(), removeProcessListener(), setParentProcess(), startSubProcess()

Constructor Detail

TestRunner

public function TestRunner(Void)

Constructs a new TestRunner.

Field Detail

MAX_TIME_UNTIL_AUTO_PAUSE

static public MAX_TIME_UNTIL_AUTO_PAUSE:Number
Time in ms until the testrunner pauses automatically.

FRAMES_UNTIL_RESUME

static public FRAMES_UNTIL_RESUME:Number
Amount of frames until resume from auto pause

Method Detail

getTestResult

public function getTestResult(Void):TestResult

Getter for the Testresult. The Testresult contains all informations about the process.

Return

Result of the TestRunner.

start

public function start()

run

public function run(test:Test):TestRunner

Runs a test.

Parameters

testTest to run.

Overrides

run() in org.as2lib.app.exec.AbstractProcess

pause

public function pause(Void):Void

Pauses the process. This is only possible during the execution of a testmethod (not before, not after). Else it will add a error to the methodInfo.

resume

public function resume(Void):Void

Resumes the process.

isTestCaseMethodFinished

public function isTestCaseMethodFinished(testCaseMethodInfo:TestCaseMethodInfo):Boolean

Parameters

testCaseMethodInfoInformation about a TestCaseMethod that should be checked if it was run already or not.

Return

true if a testcasemethod has already been processed.

getCurrentTestCase

public function getCurrentTestCase(Void):TestCaseResult

Getter for the current executing TestCase.

Return

TestCaseResult Result to the current executing TestCase.

getCurrentTestCaseMethodInfo

public function getCurrentTestCaseMethodInfo(Void):TestCaseMethodInfo

Getter for the current executing TestCaseMethod.

Return

TestCaseMethodInfo Information about the current executing TestCaseMethod

getPercentage

public function getPercentage(Void):Number

Description copied from AbstractProcess

Getter for the currently executed percentage of the process.

Specified By

getPercentage() in org.as2lib.app.exec.Process

Overrides

getPercentage() in org.as2lib.app.exec.AbstractProcess