The Google Test C++ unit testing framework provides the ability to do parameterised tests. To access the parameter of a given test, the docs tell me to derive a subclass and call GetParam()
:
class FooTest : public ::testing::TestWithParam<const char*> {
// You can implement all the usual fixture class members here.
// To access the test parameter, call GetParam() from class
// TestWithParam<T>.
};
I cannot find anything more specific than this in either the docs or the source code (inasmuch as I understand it).
Exactly where (or when) can I call GetParam()
? I know I can call it in the body of a TEST_P(...) { ... }
macro, but what about:
- In the
SetUp()
method forFooTest()
? - In the constructor for
FooTest()
? - In the intialisation list for
FooTest()
?