I am new to gtest. My job is related to hardware. When I was writting my testcases, I am wondering if there is a way that does some prechecks before each test and make result of the test successful if the precheck result is false.
For example, I am testing one of the modules I developed, it turns out that for this board, it does not even support the module. There is really no reason to continue run the following test codes. Is there a way that I can make all the test just return success? Since I have many test cases, call the check function in every testcase is very repetitive. Does gtest have some special features for this problem?
I tried SetUp()
like
class Module : public testing::Test{
protected:
void SetUp() override{
get_status = (a function i wrote to check if the board supports the module)
if (!get_status) {
SUCCEED();
}
}
unsigned int get_status;
};
But it seems not working. Can anyone tell me how to do this or show me a right example? Thank you!