How to specify multiple exclusion filters in --gtest_filter?

烂漫一生 提交于 2019-12-03 05:21:46

问题


The question is about google-test framework. I want to run all tests excluding some according to multiple exclusion filters, like: --gtest_filter=-ABC.*:-BCD.*


回答1:


You group the patterns in the form --gtest_filter=POSTIVE_PATTERNS[-NEGATIVE_PATTERNS]

So in this case, you want --gtest_filter=-ABC.*:BCD.*




回答2:


See https://blogs.msdn.microsoft.com/taxiahou/2013/07/30/the-usage-of-running-a-subset-of-tests-in-google-test-framework-gtest_filter/. You can find a clear example there.

Exclusions are identified by '-' sign. You can say multiple seperated by :. no need of repeating - with :.

--gtest_filter=-*str* :This will run tests that don't contain string "str".

--gtest_filter=-*str1*:*str2* :This will run tests that don't contain either "str1" or "str2":

--gtest_filter=*str*:-*str1*:*str2* :This will run tests that contain str and that do not contain either str1 or str2.

So, anything followed by '-' will be counted for exclusion list.

So, in your case it will be --gtest_filter=-ABC.*:BCD.*



来源:https://stackoverflow.com/questions/14018434/how-to-specify-multiple-exclusion-filters-in-gtest-filter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!