On Fri, Dec 4, 2009 at 9:35 AM, prexpressions
<prexpr...@googlemail.com> wrote:
My idea is that I would pass a specific command line parameter to the
exe at run time and within the fixture I would check this parameter
and then switch the test accordingly.
(For those interested machine A has different hardware to machine B,
the tests remain logical to perform but the expected results are
different. Is there support in the framework to somehow tell the
fixture to do something different according to a command line switch?)
Google Test doesn't directly support this, but it leaves untouched any command line arguments that it doesn't recognize after you call InitGoogleTest, as described here:
http://code.google.com/p/googletest/wiki/GoogleTestPrimer#Writing_the_main%28%29_Function
So you're free to parse whatever additional command line arguments you want at that point.
(However, depending on what exactly you're testing, it might instead be better to mock out the hardware-dependent parts of your code so that your unit tests become hardware-independent.)
--
Josh Kelley