0

我必须将我的测试与 testrail 链接起来,为此我必须使用 testrailrunner。但是,如果我排除了 springjunit 跑步者,那么我的测试在启动服务时失败,并且不可能同时使用这两个跑步者

对此有什么解决方法,以便我的测试使用服务 bean 进行初始化并仍然登录测试轨道?

4

1 回答 1

1

There is no way to have multiple test runners on single unit test, but use can use JUnit rules instead.

Spring introduces support for @Rules in 4.2 (4.2 RC1 is the latest version): https://jira.spring.io/browse/SPR-7731

I am not familiar with testrailrunner, but if it has no support for JUnit rules, you can:

  • implement custom rule for handling testrail
  • implement your own runner that handles functionality from SpringJUnit4ClassRunner and testrailrunner
  • implement custom rule for injecting Spring context - there are some implementations that are supposed to work with current Spring version: http://www.alexecollins.com/tutorial-junit-rule/ (I haven't tested it).
于 2015-06-22T19:58:17.497 回答