How to run specific test cases in GoogleTest

前端 未结 3 1976
暗喜
暗喜 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条回答
  •  无人及你
    2020-12-02 05:39

    You could use advanced options to run Google tests.

    To run only some unit tests you could use --gtest_filter=Test_Cases1* command line option with value that accepts the * and ? wildcards for matching with multiple tests. I think it will solve your problem.

    UPD:

    Well, the question was how to run specific test cases. Integration of gtest with your GUI is another thing, which I can't really comment, because you didn't provide details of your approach. However I believe the following approach might be a good start:

    1. Get all testcases by running tests with --gtest_list_tests
    2. Parse this data into your GUI
    3. Select test cases you want ro run
    4. Run test executable with option --gtest_filter

提交回复
热议问题