0

I found this interesting JUnit project: https://github.com/square/burst

It's documentation only specify how to use it with class runner. However, Since JUnit only allows 1 Runner per JUnit, using Burst means user will have difficulty run it in integration test because normally we need to run other class runner too, e.g. SpringJUnit4ClassRunner.class or other class runner. BTW my question is not specific to SpringJUnit4ClassRunner, because I may need to run other class runner as well.

Is there any way to run it with other class runner? e.g. using @Rule?

janetsmith
  • 8,562
  • 11
  • 58
  • 76
  • 1
    For Spring, you could obviously prepare the context yourself via TestContextManager, but since you need more... Afaik, there is no way to combine various runners out of the box. If the package doesn't include a Rule, you will probably have to write your own runner (or Rule). – Florian Schaetz Nov 08 '15 at 18:52
  • https://stackoverflow.com/a/37869366/6740 has the verified correct answer, working for me! – Anarchofascist Nov 14 '17 at 23:50

1 Answers1

0

For JUnit 4 that is not possible as long as you want to have a new instance of your TestClass for each test, because only Runners can create new test instances.

Stefan Birkner
  • 24,059
  • 12
  • 57
  • 72