How to run specific test cases in GoogleTest

前端 未结 3 1978
暗喜
暗喜 2020-12-02 05:10

I am trying to write a function/method for my project, which will ask to user which all test cases are you going to run? It looks like below...,

Test_Cases_1         


        
3条回答
  •  猫巷女王i
    2020-12-02 05:25

    Finally I got some answer, ::test::GTEST_FLAG(list_tests) = true; //From your program, not w.r.t console.

    If you would like to use --gtest_filter =*; /* =*, =xyz*... etc*/ // You need to use them in Console.

    So, my requirement is to use them from the program not from the console.

    Updated:-

    Finally I got the answer for updating the same in from the program.

     ::testing::GTEST_FLAG(filter) = "*Counter*:*IsPrime*:*ListenersTest.DoesNotLeak*";//":-:*Counter*";
          InitGoogleTest(&argc, argv);
    RUN_ALL_TEST();
    

    So, Thanks for all the answers.

    You people are great.

提交回复
热议问题