Testing Environments
Test RealTime - User Guide
Use the FORMAT statement to force the treatment as a pointer to an unsigned char
and use the TAB instruction to test the variable as a table. For example:
#int StubFunction(char* pChar);
DEFINE STUB Stubs
#int StubFunction(unsigned char _in Chars[4])
END DEFINE
STUB StubFunction({'a','b','c','d'})0, ({'A','B','C','D'})1
C strings
This is the default behavior:
#int StubFunction(char* pString);
DEFINE STUB Stubs
#int StubFunction(char* _in pString )
END DEFINE
STUB StubFunction("abcd")0, ("ABCD")1
Environments
Testing Environments
When drawing up a test script for a service, you usually need to write several test
cases. It is likely that, except for a few variables, these scenarios will be very similar.
You could avoid writing a whole series of similar scenarios by factorizing items that
are common to all scenarios.
Furthermore, when a test harness is generated, there are often side-effects from one
test to another, particularly as a result of unchecked modification of global variables.
To avoid these two problems and leverage your test script writing, the Test Script
Language lets you define test environments introduced by the keyword
ENVIRONMENT.
These test environments are effectively a set of default tests performed on one or
more variables.
Declaring Environments
A test environment consists of a list of variables for which you specify:
·
Default initialization conditions for before the test
·
Default expected results for after the test
Use the VAR, ARRAY, and STR instructions described previously to specify the
status of the variables before and after the test.
You can only use an environment once you have defined it.
Delimit an environment using the instructions ENVIRONMENT
<environment_name> and END ENVIRONMENT. You must place it after the BEGIN
instruction. When you have declared it, an environment is visible to the block in
which it was declared and to all blocks included therein.
152