GoogleTestRunner icon indicating copy to clipboard operation
GoogleTestRunner copied to clipboard

Allow to configure a (regex?) pattern which is used to find executables containing tests

Open jonnydee opened this issue 11 years ago • 6 comments

The documentation says test executables are (only) found if their file names end with 'test' or 'tests'. However, in our (very big) project we cannot change how our test executables are named, because their name follows a company-wide naming rule and the complete build system relies on it and, hence, such a change would be very expensive. So it would be nice if there was a way to customize how those test executables may be named. The most flexible way would be a regular expression. But a configurable list of file name postfixes would also suffice -- at least in our case. For backward compatibility, you could define a regular expression maching file names ending with 'test' or 'tests', or if youl rather liked the second approach, you could add 'test' and 'tests' to that postfix list as a default.

jonnydee avatar Jan 12 '15 08:01 jonnydee

Hi Jonny.

The limitation for the output file name is because the extension actually runs the executable and for security reasons it is best to limit it as much as possible while still being useful.

I'm afraid you need to recompile the extension to change the pattern which is used to look for tests. However, if you use the effort to make it configurable I can repackage a new version of the extension and ship it to all users.

Regards, Markus

markusl avatar Jan 12 '15 08:01 markusl

What do you mean by recompile? Shouldn't it be on tools|options or somewhere similar?

evakili avatar Jan 13 '15 11:01 evakili

@evakili I mean, to change the regex pattern, the extension needs to be packaged again. The extension does not make the regex pattern configurable at the moment.

markusl avatar Jan 13 '15 11:01 markusl

I know this issue is more than a year old, but we are having pretty much the same problem over here. We are still having plenty of CPPUnit test hosts, which are (huge surprise) all called <ProjectName>TestHost. As all our CPPUnit Testhosts support the command line parameter and so does the gtest runner, I figured it might be a good idea to call the executable with -h first and only tread it as a google test runner if the parameter "--gtest_list_tests" is found in the result. I just created a pull request. I hope that solution might help some of you as well.

@markusl As my f# knowledge is very limited (or not existing if you wanna put it like that) you might wanna take a look and optimize it a bit. At least I tried ;)

noizefloor avatar Feb 24 '16 15:02 noizefloor

I just found GoogleTestAdapter. It's pretty much a port of the Google Test Runner in C#, which is already way better for me. Also it let's you configure the pattern to discover Test binaries. You can do that globally (Tools->Options->Google Test Adapter) or by using a configuration file for every solution. That means you can leave the global setting empty and configure the explicit test host name in the configuration file. Exactly what I was looking for.

noizefloor avatar Mar 03 '16 12:03 noizefloor

We're in the same situation as @jonnydee. This adapter project looks great but we can't use it because we can't rename our test projects...

philmccarthy24 avatar May 10 '16 10:05 philmccarthy24