Skip to content
EbenZhang edited this page May 28, 2013 · 2 revisions

How To Use

Table of Contents

Where to place the tests?

Grammar and details

Including

You should including cppunitlite.h in every test cpp file.

And add "your cppunitlite dir" to your project's include dir

TEST_GROUP

Tests must be attached to a TEST_GROUP(some test framework call it test fixture), Group's name is usually the same as the class that you want to test.

TEST_GROUP is actually implemented as a class, so do not forget the ';'

TESTs

The formatter is TEST(!YourTestGroupName,!DescribeWhatYouWantToTest)

CHECK

CHECK(someBOOLCondition)

if someBOOLCondition is 0, then CHECK will cause a failure.

SETUP and TEARDOWN

TEST_CTOR

Constructor of TestGroup in order to initialize reference (and other must be initialized types) in a class.

Link to cppunitlite.lib

The main function

TEST_ONLY

When using TEST_ONLY instead of TEST, the runner will ignore all other test cases.