|
For each class in the unit create a .cpp file,
which contains the tests for this class. |
// begin our_unit_FirstClass.cpp
#include <acdk/tools/aunit/TestRunner.h>
#include <your/unit/FirstClass.h>
namespace tests {
namespace our {
namespace unit {
BEGIN_DECLARE_TEST( FirstClass_Test )
DECLARE_TEST( constructors )
DECLARE_TEST( method1 )
// more tests here
END_DECLARE_TEST( FirstClass_Test )
BEGIN_DEFINE_TEST( FirstClass_Test )
ADD_TEST( FirstClass_Test, constructors )
ADD_TEST( FirstClass_Test, method1 )
// more tests here
END_DEFINE_TEST( FirstClass_Test )
using namespace acdk::lang;
using namespace your::unit;
void FirstClass_Test::constructors()
{
RFirstClass fc = new FirstClass();
testAssert(fc != Nil);
testAssert(fc->isOk());
//etc.
}
void FirstClass_Test::method1 ()
{
int expectedVal = 42;
RFirstClass fc = new FirstClass();
testAssert(fc->method1() == expectedVal);
}
} // namespace unit
} // namespace our
} // namespace tests
// end our_unit_FirstClass.cpp
|
Run the tests
./our_unit_Test |
# test the class FirstClass ./our_unit_Test FirstClass_Test # test only method FirstClass_Test.method1 ./our_unit_Test FirstClass_Test.method1 |
./our_unit_Test -test-list |
HTML reports-test-htmlreport
HTML report pages are generated for the test in $ACDKHOME/testreports.
More options-help to receive
all available options.
Using CfgScript as Unit Tests
// C++
using namespace acdk::tools::aunit;
TestRunnerStaticAdder scriptTests(new CfgScriptTestSuite("$(ACDKHOME)/acdk_sql_sqlite/cfg/csf/tests/acdk/sql/sqlite", true));
|
$(ACDKHOME)/acdk_sql_sqlite/cfg/csf/tests/acdk/sql/sqlite (and subdirectories)
which ends with _Test.csf as unit test.
API documentation
API documentation.
GUI Test Runner
ACDK WX module.acdkcfgscript[_d.exe|_r.exe] acdk_core/cfg/csf/lib/test/AcdkTestRunner.csf.
GUI to run ACDK Unit Tests
CfgScript and
ACDK WX.