0

I have a test suite written in QTestLib. That's legacy. The QTest tests are invoked from a main method initialized like a regular gtest suite.

On the CI server we invoke regular gtests with a 'time sensitive exclusion' filter like

> testsuite.exe --gtest_filter=-*TimeSensitive*

Now I would like to try disabling some of these time sensitive tests by 'listening' to the gtest_filter. So the question: can I use something equivalent to this?

MyTest::test_TimeSensitiveTestMethod() {
    if (!::testing::gtest_filter("MyTest_TimeSensitiveTestMethod")) return;
    EXPECT_EQ(1, 2);
    ...
}
xtofl
  • 40,723
  • 12
  • 105
  • 192

1 Answers1

0

Actually solved the problem by merely wrapping the qtests into gtests:

TEST(MyGtestWrapper, theQtest_TimeSensitive) {
    MyTest test;
    ASSERT_NE(QTEST_FAILED, QTest::exec(&test, 0, 0));
}

The test main has to instantiate a QApplication and exec it, of course.

xtofl
  • 40,723
  • 12
  • 105
  • 192