Hi Steinar,

Like this one:

https://github.com/apache/karaf/blob/main/itests/test/src/test/java/org/apache/karaf/itests/DiagnosticTest.java

For example, in this class we have several tests using a single Karaf
instance (depending of the @ExamReactorStrategy(PerClass.class)
annotation, PerClass meaning a single Karaf instance for all test
methods in the class).

Regards
JB

On Thu, Mar 23, 2023 at 10:11 PM Steinar Bang <s...@dod.no> wrote:
>
> I am trying to rewrite an old pax exam test into being based on
> KarafTestSupport.
>
> The old test fired up a karaf instance with a feature that exposes a
> service, and then injected that service into the test class and used the
> service in multiple @Test methods.
>
> However the class based on KarafTestSupport seems to only work with a
> single @Test method.
>
> If I try to have more than one @Test methods, all tests fail with
> ClassNotFoundException on the service interface.
>
> Is it possible to have more than one @Test method in a KarafTestSuppor
> class.
>
> I could break up the test class into multiple test classes, but then I
> would have to boot karaf once for each test class, and that's kind of
> costly.
>
> I would prefer to boot karaf only once for all tests.
>
> Is it possible?
>
> Thanks!
>
>
> - Steinar
>

Reply via email to