diff -r f1112f777ce9 -r 96906a986c3b testdev/ite/src/com.nokia.testfw.sut.help/html/references/classes_and_macros.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testdev/ite/src/com.nokia.testfw.sut.help/html/references/classes_and_macros.htm Tue Mar 30 14:39:29 2010 +0800 @@ -0,0 +1,36 @@ + + + + +Classes and macros + + + +

Classes and macros

+ +

1. There are several macros used in Symbian Unit Test Framework, we should define the macro SYMBIAN_UNIT_TEST in our test project’s mmp file to enable them.

+

BASE_CONSTRUCT:
+    Calls the base class constructor that sets the name of unit test, usually used in ConstructL in wrapper class.

+

ADD_SUT( aTestPtr ):
+    Adds a new unit test case to this unit test. The default setup and teardown functions will be used.

+

ADD_SUT_WITH_SETUP_AND_TEARDOWN( aSetupPtr, aTestPtr, aTeardownPtr ):
+    Adds a new unit test case to this unit test. The user can specify the customized setup and teardown functions.
+   
+SUT_ASSERT( aCondition ):
+    Asserts a condition in a unit test case. Leaves with a Symbian unit test framework specific error code if the condition evaluates to EFalse.

+

SUT_ASSERT_EQUALS( aExpected, aActual ):
+    Asserts that two values are equal. Leaves with a Symbian unit test framework specific error code if the values are not equal.

+

SUT_ASSERT_LEAVE_WITH( aStatement, aError ):
+    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.

+

SUT_ASSERT_LEAVE( aStatement ):
+    Asserts that a statement leaves. The macro itself leaves with a Symbian unit test framework specific error code if the statement leaves.

+

The detailed explaination can be found in symbianunittestmacros.h.

+

2. Classes in Symbian Unit Test Framework.

+

In this section, we will review some key classes in SymbianUnitTest Framework. While writing a test project, below classes should be aware of from the client’s perspective:

+

CSymbianUnitTest
+CSymbianUnitTest is a basic test unit; it corresponds to the class which we will test. Client programmer should derive from it and implement test code in CSymbianUnitTest’s derived class.
+Client user needs to override two methods SetupL and Teardown if extra initialization needed to run test case.

+

CSymbianUnitTestSuite
+CSymbianUnitTestSuite is the collection/container of CSymbianUnitTest. On the other words, it simply collects a number of CSymbianUnitTest's derived classes and run them during a particular test run.

+ +