Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Excerpt

Defines the mode in which a unit test is run...

 

Test.any( )

Indicates that a test may create zero or more results, and the number of results does not affect the overall test success.

This is the default for tests that do not specify a testMode.

Test.expect( n )

Indicate that the current test is expected to generate n test results. If the test does not generate that many results, the test will fail.

Test.until( n[, gameSeconds] )

Indicates that a a test is split in to more than one unit and is used for asynchronous testing. The number n indicates how many results are required to complete the test. The optional gameSeconds parameter indicates how long to wait before timing out the test (defaults to 60 seconds).

Results can be provided by the current Test.until( ) and subsequent Test.append( ) tests. No new tests will start until the number of required results is generated, or the test times out, or the test is aborted.

Test.duration( gameSeconds )

Indicates the test should run for a specific amount of time. The number gameSeconds defines how many game seconds (which are affected by game speed) results will be gathered for.

Results can be provided by the current Test.duration( ) and subsequent Test.append( ) tests. No new tests will start until the number of required results is generated, or the test times out, or the test is aborted.

Test.append( testName )

Indicates the test is a continuation of a specific Test.until( ) or a Test.duration( ) test that has a name of testName.

If the test called testName is not currently active, tests that append results to that test will be ignored.

 

Overview

When defining a Unit Tests with Test(), a "test mode" is required to define the way in which the test will be processed.

There are currently 4 modes available:

ModeNotesAPI Version
Test.ANY()

A basic test test which will pass if none of it's assertions fail and no test-failing Test Signals are triggered.

1.0
Test.EXPECT()The same as Test.ANY( ) but requires a specific number of results to be logged before allowing a test to pass.1.0
Test.ASYNCH()

A asynchronous test that can have results added to it by subsequent Test.APPEND( ) tests. The test will remain active until it either fails, passes or times-out. Very useful for testing non-sequential events.

1.0
Test.APPEND()Appends results to a specific Test.ASYNCH( ) if that test is currently active.1.0

Synchronous vs. Asynchronous

Each test runs in a test session. Only one session can be running at any given time.

The Test.ANY( ) and Test.EXPECT( ) modes are synchronous – the state of the test will always be determined at the end of the unit test. Essentially, each test with these modes has it's own session in which it is the only test that will run.

The Test.ASYNCH( ) mode, however, can be either synchronous or asynchronous:

  • If the test passes or fails, it will act like a Test.ANY( ) or Test.EXPECT( ).
  • If the test state has not been determined at the end of the test, an asynchronous session will start, allowing subsequent Test.APPEND( ) mode tests to add more results to the test.

Asynchronous tests are useful for testing events, where there will be a gap between starting the test and the subsequent results being obtained. For more information on asynchronous testing, see Test.ASYNCH( ).

Div
classbox
Availability
Status
colourGreen
titleStable

Requires:

Div
classbox

Test API

Topics:

Child pages (Children Display)
alltrue
depthall
pageTest API
excerpttrue