# UnitTest.hpp
This File On Github
Ask A Question
API: latest
module: oatpp
#include "oatpp-test/UnitTest.hpp"
# UnitTest
Base class for unit tests.
namespace oatpp { namespace test {
class UnitTest {}
}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | UnitTest | Constructor. |
[none] | ~UnitTest | Default virtual destructor. |
void | run | Multiple implementations:
|
void | onRun | Override this method. It should contain test logic. |
void | before | Optionally override this method. It should contain logic run before all test iterations. |
void | after | Optionally override this method. It should contain logic run after all test iterations. |
void | runTest | Run this test repeatedly for specified number of times. |
# UnitTest::UnitTest
Constructor.
- @param testTAG - tag used for logs.
UnitTest(const char* testTAG)
: TAG(testTAG)
# UnitTest::~UnitTest
Default virtual destructor.
virtual ~UnitTest() = default
# UnitTest::run
- Run this test repeatedly for specified number of times.
- @param times - number of times to run this test.
void run(v_int32 times)
- Run this test.
void run()
# UnitTest::onRun
Override this method. It should contain test logic.
virtual void onRun() = 0
# UnitTest::before
Optionally override this method. It should contain logic run before all test iterations.
virtual void before()
# UnitTest::after
Optionally override this method. It should contain logic run after all test iterations.
virtual void after()
# UnitTest::runTest
Run this test repeatedly for specified number of times.
- @tparam T - Test class.
- @param times - number of times to run this test.
template<class T>
static void runTest(v_int32 times)
# OATPP_RUN_TEST
Convenience macro to run test.
Usage Example:
OATPP_RUN_TEST(oatpp::test::web::FullTest);
Running the test 10 times: OATPP_RUN_TEST(oatpp::test::web::FullTest, 10);
#define OATPP_RUN_TEST(...)