jeudi 2 mars 2017

Google unit test Set up by default

I am making a unit test system with google unit test in C++. And I noticed that all my set up of the unit test contain the same line, and all my tears down contain other line, equal for all.

I wonder if there is any way to create a set up by default to be called before the actual set up of the any unit test.

#include <gtest.h>
class TestExample : ::testing::Test
{
    public:
        virtual void SetUp ()
        {
            //same line for all tests of my system
            my_system::clean_system();

            //code of specific setup
            //...
        }
        virtual void TearDown ()
        {
            //Code of specific teardown
            //...

            my_system::clean_system();
        }
};

Aucun commentaire:

Enregistrer un commentaire