Further Study in Symbian Unit Test.
1. SUT for negative test.
There are also some methods provided by CSymbianUnitTest for running negative test cases.
SUT_ASSERT
Asserts a condition in a unit test case. Leaves with a Symbian unit test framework specific error code if the condition evaluates to EFalse.
In case of a failed assertion, the framework records the failure reason, line number and file name to the test results.
SUT_ASSERT_EQUALS
Asserts that two values are equal. Leaves with a Symbian unit test framework specific error code if the values are not equal.
In case of a failed assertion, the framework records the failure reason, line number and file name to the test results.
SUT_ASSERT_LEAVE_WITH
Asserts that a statement leaves an expected value. Leaves with a Symbian unit test framework specific error code if the leave code is not the expected one.
In case of a failed assertion, the framework records the failure reason, line number and file name to the test results.
Note: SUT_ASSERT_LEAVE_WITH should be used instead whenever possible, because the implementation of SYMBIAN_UT_ASSERT_LEAVE TRAPs also KErrNoMemory. This means that all the memory allocations are not looped through during the memory allocation failure simulation.
SUT_ASSERT_LEAVE
Asserts that a statement leaves. The macro itself leaves with a Symbian unit test framework specific error code if the statement leaves.
In case of a failed assertion, the framework records the failure reason, the line number and file name to the test results.
2. Interact with ATS.
SUT can also interact with ATS, please refer to ATS User Guide for more information.
3. Convert EUNIT test case to SUT.
There is a useful tool named eunit_to_symbianunit.pl, we can use it to convert the existing EUNIT test cases to SUT. Run it under the eunit test cases folder then the test cases are converted to SUT test cases.