<bdo id='R2wZJ'></bdo><ul id='R2wZJ'></ul>
      <tfoot id='R2wZJ'></tfoot>

    1. <i id='R2wZJ'><tr id='R2wZJ'><dt id='R2wZJ'><q id='R2wZJ'><span id='R2wZJ'><b id='R2wZJ'><form id='R2wZJ'><ins id='R2wZJ'></ins><ul id='R2wZJ'></ul><sub id='R2wZJ'></sub></form><legend id='R2wZJ'></legend><bdo id='R2wZJ'><pre id='R2wZJ'><center id='R2wZJ'></center></pre></bdo></b><th id='R2wZJ'></th></span></q></dt></tr></i><div id='R2wZJ'><tfoot id='R2wZJ'></tfoot><dl id='R2wZJ'><fieldset id='R2wZJ'></fieldset></dl></div>

      <small id='R2wZJ'></small><noframes id='R2wZJ'>

    2. <legend id='R2wZJ'><style id='R2wZJ'><dir id='R2wZJ'><q id='R2wZJ'></q></dir></style></legend>

      如何在 GoogleTest 中运行特定的测试用例

      时间:2023-05-23
      • <bdo id='J9YFQ'></bdo><ul id='J9YFQ'></ul>
        <i id='J9YFQ'><tr id='J9YFQ'><dt id='J9YFQ'><q id='J9YFQ'><span id='J9YFQ'><b id='J9YFQ'><form id='J9YFQ'><ins id='J9YFQ'></ins><ul id='J9YFQ'></ul><sub id='J9YFQ'></sub></form><legend id='J9YFQ'></legend><bdo id='J9YFQ'><pre id='J9YFQ'><center id='J9YFQ'></center></pre></bdo></b><th id='J9YFQ'></th></span></q></dt></tr></i><div id='J9YFQ'><tfoot id='J9YFQ'></tfoot><dl id='J9YFQ'><fieldset id='J9YFQ'></fieldset></dl></div>

          <tfoot id='J9YFQ'></tfoot>
              <tbody id='J9YFQ'></tbody>

              <small id='J9YFQ'></small><noframes id='J9YFQ'>

              <legend id='J9YFQ'><style id='J9YFQ'><dir id='J9YFQ'><q id='J9YFQ'></q></dir></style></legend>

                本文介绍了如何在 GoogleTest 中运行特定的测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我正在尝试为我的项目编写一个函数/方法,它会询问用户您要运行哪些所有测试用例?它看起来像下面...,

                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
                         |_TestNo1
                         |_TestNo2....so on
                Test_Cases_2
                         |_TestNo1
                         |_TestNo2....so on
                ....
                ....so on
                Test_Cases_N
                         |_TestNo1
                         |_TestNo2....so on
                

                那么,现在的挑战是在运行项目时,它应该提示我您想要执行的所有测试用例是什么?如果我选择 Test_Cases_1Test_Cases_N.然后它应该执行这两个测试用例,并且应该排除 Test_Cases_2 to .... 中的所有其他测试用例.在结果窗口中,我也想看到 Test_Cases_1Test_Cases_N 的结果.

                So, now the challenge is while running the project it should prompt me what all test cases you would like to execute? If I select Test_Cases_1 and Test_Cases_N. Then it should execute these two test cases and should exclude all other from Test_Cases_2 to ..... In result window also I would like to see the results of Test_Cases_1 and Test_Cases_N.

                所以,如果我看到GoogleTest,有一个方法叫做test_case_to_run_count();但是所有的 test cases 都使用 Test_F() 方法注册.所以,我做了很多分析,但仍然没有找到任何解决方案.请帮帮我.

                So, if I will see the GoogleTest, there is a method called test_case_to_run_count(); But all the test cases are getting registered with Test_F() method. So, I did lots of analysis, but still did not find any solution. Please help me.

                推荐答案

                您可以使用 高级选项 用于运行 Google 测试.

                You could use advanced options to run Google tests.

                要仅运行一些单元测试,您可以使用 --gtest_filter=Test_Cases1* 命令行选项,其值接受 *?用于匹配多个测试的通配符.我认为它会解决您的问题.

                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.

                更新:

                嗯,问题是如何运行特定的测试用例.将 gtest 与您的 GUI 集成是另一回事,我无法真正评论,因为您没有提供您的方法的详细信息.不过我相信以下方法可能是一个好的开始:

                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. 通过使用 --gtest_list_tests
                2. 运行测试来获取所有测试用例
                3. 将此数据解析到您的 GUI 中
                4. 选择要运行的测试用例
                5. 使用选项--gtest_filter运行测试可执行文件
                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

                这篇关于如何在 GoogleTest 中运行特定的测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:srand(time(NULL)) 产生类似的结果 下一篇:为什么 Visual Studio 找不到我的 DLL?

                相关文章

                最新文章

                1. <legend id='VUx74'><style id='VUx74'><dir id='VUx74'><q id='VUx74'></q></dir></style></legend>

                  1. <i id='VUx74'><tr id='VUx74'><dt id='VUx74'><q id='VUx74'><span id='VUx74'><b id='VUx74'><form id='VUx74'><ins id='VUx74'></ins><ul id='VUx74'></ul><sub id='VUx74'></sub></form><legend id='VUx74'></legend><bdo id='VUx74'><pre id='VUx74'><center id='VUx74'></center></pre></bdo></b><th id='VUx74'></th></span></q></dt></tr></i><div id='VUx74'><tfoot id='VUx74'></tfoot><dl id='VUx74'><fieldset id='VUx74'></fieldset></dl></div>

                    <tfoot id='VUx74'></tfoot>

                    <small id='VUx74'></small><noframes id='VUx74'>

                      <bdo id='VUx74'></bdo><ul id='VUx74'></ul>