Test

private class
unittest.Test

Description

Represents an individual test case. Each test can have several assertions, the results of which are saved in the results Vector after running the test.

API overview

Constructor

Test ()

Attributes

Public attributes

async: Boolean

This is set to true if this is an asynchronous test based on the method signature

meta: MetaInfo

Reference to the Test metadata tag info object

method: MethodInfo

Reference to the MethodInfo object of the test method

name: String

The name of the test method

report: StatusReport

Contains Assert-level metrics for how many of them passed, failed and were skipped

results: Vector.<AssertResult>

Contains the results of all the assertions in the test

skip: Boolean

This is set to true if the method was set to be skipped

target: Object

Can be either a Type in case of static method tests or an instance in case of instance method tests

type: Type

The Type containing the test

Functions

Public functions

run ( c: TestComplete = null ): Object

Runs the method, the results of all the assertions are gathered in the Assert class

Constructor

Test ()

Attributes

async: Boolean

This is set to true if this is an asynchronous test based on the method signature.

meta: MetaInfo

Reference to the Test metadata tag info object.

method: MethodInfo

Reference to the MethodInfo object of the test method.

name: String

The name of the test method.

report: StatusReport

Contains Assert-level metrics for how many of them passed, failed and were skipped.

results: Vector.<AssertResult>

Contains the results of all the assertions in the test. Generally only the failed assertions are kept track of uniquely.

skip: Boolean

This is set to true if the method was set to be skipped.

target: Object

Can be either a Type in case of static method tests or an instance in case of instance method tests.

type: Type

The Type containing the test.

Functions

getFullTypeName (): String
Inherited from Object

native

Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.


Returns

String fully qualified type name of the Object.

getType (): Type
Inherited from Object

native

Gets the Type that describes the Object.


Returns

Type The Type that describes the object.

getTypeName (): String
Inherited from Object

native

Gets the type name of the Object.


Returns

String type name of the Object.

run ( c: TestComplete = null ): Object

Runs the method, the results of all the assertions are gathered in the Assert class.

class contains a done function that is called when the async test has finished.

for asynchronous tests. Usually void, however if set, it is shown next to the test result as a String.

Parameters

c: TestComplete = null Only used for asynchronous tests. The `TestComplete`

Returns

Object Returns a custom result object of the test, always `null`

toString (): String
Inherited from Object

native

Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().


Returns

String String that described the Object.

: