多次调用一次测试 - Google测试

Mar*_*ero 8 c++ testing googletest random-testing

我正在尝试在我正在开发的一个软件中执行一些随机测试.
我有一个用随机值初始化的灯具,因此,每个测试都有不同的输入.

此外,我想要的是多次运行其中一个测试(我希望每次执行时都会随机初始化灯具),是否可以在Google测试中使用?我需要在代码中,而不是使用参数或类似的东西.

我在找invocationCountJUnit之类的东西.

jme*_*lfe 10

使用未使用的参数和Range()这样的事情怎么样?

class Fixture : public ::testing::TestWithParam<int> {
    //Random initialisation
};

TEST_P(Fixture, Test1){}

INSTANTIATE_TEST_CASE_P(Instantiation, Fixture, ::testing::Range(1, 11));
Run Code Online (Sandbox Code Playgroud)

Test1 将被调用10次,每次都会创建一个新夹具.