jeudi 30 avril 2015

Executing test from another test in google test framework

Let's say I have two tests in the same testcase: writeTest and readTest

TEST_F(testcase, writeTest)
{
  ASSERT_EQ(OK, write_something();
} 

TEST_F(testcase, readTest)
{
  ASSERT_EQ(OK, write_something();
  ASSERT_EQ(OK, read_something();
}

My question is, can I execute writeTest from readTest?

To read something there must be something written. So I want to execute the writeTest (while being in test code of readTest) rather than repeating the codes of writeTest?

This is specially important when there is huge line of code in the writeTest.

Aucun commentaire:

Enregistrer un commentaire