I need to run my test multiple times in succession (4 times, one for each browser I am testing with WebDriver). I understand that this is a use case for parameterized tests. However, I am utilizing ClasspathSuite
and so it seems I cannot specify multiple @RunWith
annotations.
Is there any way I can get my test to run multiple times and send some sort of parameter (like 0 - 3 for the 4 runs I need) to the test?
I just faced this, ClasspathSuite
handles this just fine. The trick is to use these annotations in the little dummy project that finds & launches tests (across other projects):
@RunWith(ClasspathSuite.class)
@SuiteTypes(RUN_WITH_CLASSES)
Then any test requiring a specific runner just uses that runner directly, such as @RunWith(Parameterized.class)
See section "Running other RunWith-Suites" here: https://github.com/takari/takari-cpsuite
Due to a wide range of tests, I opted to use all options:
@SuiteTypes({RUN_WITH_CLASSES, TEST_CLASSES, JUNIT38_TEST_CLASSES})
(The default appears to be just TEST_CLASSES.)
解决方案:我对每个测试用例进行了相同的参数设置(使用Eclipse中的replace方法将相同的代码添加到每个测试用例中。然后,我设置了代码清理和格式,因此当我运行它们时,它将代码恢复为漂亮的状态(因为我的插入内容全部在一行上)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.