I have the following class hierarchy:
class A: public CxxTest::TestSuite
{
_prerequisitefunc();
public:
testA() { _prerequisite(); doTestAStuff(); }
};
class B: public A
{
public:
testB() { _prerequisite(); doTestBStuff(); }
};
1. Is this allowed - in terms of test suite B inheriting from A?
2. When I invoke test suite B, would it execute testA() as well?
3. If answer to 2 is yes, then does it follow an order of executing testA() before testB()?
4. I don't want testA() to be executed when test suite B is invoked. Can I inherit from A in the protected/private mode so that testA() is protected/private in class B? Would that prevent testA() from being discovered as part of test suite B?
Thanks!
P.S. For anyone interested in more context -
I have two tests - testA and testB that both have a common code, which is abstracted in the _prerequisite function. I can't put both testA and testB under the same test suite because I need testA to be always performed before testB (testA changes state in the sys environment that's needed for testB - can't mock it). I want to be able to leverage the common code while also running these two tests independently.