Search code examples
javamavenjunitkarafpax-exam

Pax exam karaf maven test


Hi i have a problem with pax exam on maven.

This is my abstract test runner each test extends this class

RunWith(PaxExam.class)
@ExamReactorStrategy(PerSuite.class)
public abstract class CommonSuiteTest {

  @Configuration
  public Option[] config() {...}

  abstract public Option[] getAdditianalOptions();
}

And test class

  public class SomeTest extends CommonSuiteTest {

    private static final Logger logger = LoggerFactory.getLogger(SomeTest.class);

    @Inject @Filter(value="(camel.context.name=testRoute)", timeout=10000)
    protected CamelContext context;

    @Test
    public void someTest() throws Exception {...}
}

In IDE everything works as suppose I can run one instance of karaf and all test are deployed and started, great.

But on maven each test class is started on different instance of karaf. This problem produce that phase clean install take a lot time.

How can I avoid this behavior in maven.

Mariusz.


Solution

  • I found workaround:

    https://github.com/Pardus-LiderAhenk/lider-ahenk-test-framework/wiki/4.-Grouping-Your-Tests

    It is ugly but test are executed on one instance of karaf