Test Case Labels or Categorisation Needed

393 views
Skip to first unread message

René Meusel

unread,
Feb 11, 2015, 6:14:18 AM2/11/15
to googletes...@googlegroups.com
Hello gtest users,

I am looking for a smart way to categorise or label my test cases to only run subsets.
For example to label long-running tests (say > 50ms) as 'slow' and exclude those from automatic runs in our continuous integration system.
Using --gtest-filter would be an option, but I want to avoid keeping the continuous integration scripts in sync when new test cases are added.

A rather pragmatic way of doing so would be to add a suffix to each 'slow' test case name and use --gtest-filter to exclude tests ending on '*Slow'.
Is there a better way of doing this?

Cheers,
René

BarbaraJoy Jones

unread,
Feb 11, 2015, 10:29:58 AM2/11/15
to René Meusel, Google C++ Testing Framework
I did something very similar to this. I use the suffix "Long" for test cases that will take a significant amount of time. I added a command-line flag for running "partial" tests. When that flag is specified, I parse the filter (if specified) and add "*Long" to exclude those tests. I've got two jobs for the continuous integration system, one that uses the flag and one that doesn't. No need to change the commands when adding new test cases.

--

---
You received this message because you are subscribed to the Google Groups "Google C++ Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

René Meusel

unread,
Feb 11, 2015, 12:01:53 PM2/11/15
to googletes...@googlegroups.com, dro...@gmail.com
I did something very similar to this. I use the suffix "Long" for test cases that will take a significant amount of time. I added a command-line flag for running "partial" tests. When that flag is specified, I parse the filter (if specified) and add "*Long" to exclude those tests.

Yes, that is pretty much what I meant with my 'pragmatic' idea. But I would find it handy if googletest would programatically support such labels. The advantage would be that you could have multiple labels for individual test cases. Like for example a single test case could be labeled as 'slow', 'http' (as it needs some HTTP mocking) and 'stresstest' (as it does some heavy listing with the testee).

Just wanted to be sure that I didn't overlook this feature somehow.
Reply all
Reply to author
Forward
0 new messages