How To Use
 All Modules Pages
#include "stdafx.h"
#include "../../TestToolBox.h"
namespace TTB = TestToolBox;
//-----------------------------------------------------------------------------
/// [example of a simple test fixture]
class MySimpleFixture
{
public:
explicit MySimpleFixture(std::string const& in_configFile = "Default")
: m_configFile(in_configFile)
{
// writes info to test protocol
TTB_INFO_S("Constructor MySimpleFixture " << m_configFile);
// start up test environment, set needed state, ...
}
~MySimpleFixture()
{
TTB_INFO_S("Destructor MySimpleFixture " << m_configFile);
// tear down test environment or reset state changes, ...
}
private:
std::string m_configFile;
// ... (other data needed within destructor)
};
/// [example of a simple test fixture]
//-----------------------------------------------------------------------------
/// [test case starts with test fixture]
TTB_BOOST_TEST_CASE(TestSomething)
{
MySimpleFixture myFixture; // Constructor prepares for testing
// test instructions follow...
// automatic destruction of MyFixture
}}
/// [test case starts with test fixture]
//-----------------------------------------------------------------------------
/// [test case starts with test fixture with arguments]
TTB_BOOST_TEST_CASE(TestSomethingElse)
{
MySimpleFixture myFixture("ConfigFile_X");
// test instructions follow...
// automatic destruction of MyFixture
}}
/// [test case starts with test fixture with arguments]
//-----------------------------------------------------------------------------
/// [boost test suite fixture]
// Start tag of test suite. Fixture MySimpleFixture is constructed BEFORE EACH test case!
BOOST_FIXTURE_TEST_SUITE(TestSuiteWithFixtureCalledBeforeEachTestCase, MySimpleFixture);
// Test cases within test suite:
TTB_BOOST_TEST_CASE(TestCaseA)
{
}}
TTB_BOOST_TEST_CASE(TestCaseB)
{
}}
TTB_BOOST_TEST_CASE(TestCaseC)
{
}}
// End tag of test suite
BOOST_AUTO_TEST_SUITE_END();
/// [boost test suite fixture]