Package | org.flexunit.internals.runners.statements |
Class | public class FailOnTimeout |
Inheritance | FailOnTimeout ![]() ![]() |
Implements | IAsyncStatement |
FailOnTimeout
is a decorator that is responsible for determing
whether a specific test method has exceeded a timeout period for execution. A test
method normally will run to completion regardless of how long it takes the test to
execute; however, if a timeout is imposed on the test method, the test will
fail if the test does not finish within the time limit.
In order to fail on a timeout, a test method must include metadata indicating it has
a timeout time limit. The timeout time limit is expected to be provided in milliseconds.
[Test(timeout=100)]
public function timeoutTest():void {
//Test to run
}
Method | Defined By | ||
---|---|---|---|
FailOnTimeout(timeout:Number, statement:IAsyncStatement)
Constructor. | FailOnTimeout | ||
evaluate(parentToken:AsyncTestToken):void
Evaluates the object that implements the IAsyncStatement and starts the timeout timer. | FailOnTimeout | ||
handleNextExecuteComplete(result:ChildResult):void
Stops the timer and sends any error the result has encountered to the parentToken. | FailOnTimeout | ||
hasTimeout(method:FrameworkMethod):String [static]
Determine if the method test has a timeout by checking its metadata to see if it
contains a "timeout" string. | FailOnTimeout |
FailOnTimeout | () | Constructor |
public function FailOnTimeout(timeout:Number, statement:IAsyncStatement)
Constructor.
Parameterstimeout:Number — The amount of time in milliseconds to wait before attempting to fail the test.
| |
statement:IAsyncStatement — The current object that implements IAsyncStatement to decorate.
|
evaluate | () | method |
public function evaluate(parentToken:AsyncTestToken):void
Evaluates the object that implements the IAsyncStatement
and starts the timeout timer.
Parameters
parentToken:AsyncTestToken — The token to be notified when it has been determined if a timeout has occured.
|
handleNextExecuteComplete | () | method |
public function handleNextExecuteComplete(result:ChildResult):void
Stops the timer and sends any error the result
has encountered to the parentToken. If
the timer has already finished, the parentToken has been already notified of the failure and nothing
further will occur.
Parameters
result:ChildResult — The ChildResult to check to see if there is an error.
|
hasTimeout | () | method |
public static function hasTimeout(method:FrameworkMethod):String
Determine if the method
test has a timeout by checking its metadata to see if it
contains a "timeout" string.
Parameters
method:FrameworkMethod — The FrameworkMethod to check to see if it has a timeout.
|
String — a String indicating the length of the the timeout if the method
contains metadata that indicates the method contains a timeout; otherwise, a value of null
will be returned.
|