Do not restart Dropwizard between integration tests

150 views
Skip to first unread message

Alexander Najafi Anzén

unread,
Dec 9, 2022, 3:01:17 AM12/9/22
to dropwizard-user
We have a setup with quite a large number of integration tests, each in different classes. For every test we start Dropwizard using the DropwizardAppExtension as exaplined in the documentation, example below.

Using the AppExtension causes the Dropwizard application to start before running the tests of each class and to stop the application when the tests has finished. 

Our issue is that the startup and shutdown process of our application is quite heavy and takes some time (~15 seconds). We have to connect to subscribe Kafka topics, do some work and so on which takes a lot of time.

Is there any way to start Dropwizard once and reuse it for all integration tests? I know Spring Boot has this feature and only starts a new instance of the application if the configuration differs between applications. 

In every integration test we start up the application using something like:

public static final DropwizardAppExtension<MyServiceConfiguration> RULE =
new DropwizardAppExtension<>(
MyApplication.class, ResourceHelpers.resourceFilePath("testing.yml"));
Message has been deleted

Alexander Najafi

unread,
Dec 9, 2022, 4:02:25 AM12/9/22
to dropwiz...@googlegroups.com
I also tried setting up a Suite without any success

@Suite
@SelectClasses({FirstIT.class, SecondIT.class})
public class MyTestSuite {
    public static final DropwizardAppExtension<MyServiceConfiguration> DROPWIZARD =
        new DropwizardAppExtension<>(MyApplication.class, ResourceHelpers.resourceFilePath("testing.yml"));
}

And the tests:

@ExtendWith(DropwizardExtensionsSupport.class)
public class FirstIT {
    public static final DropwizardAppExtension<MyServiceConfiguration> RULE = MyTestSuite.DROPWIZARD;
}

@ExtendWith(DropwizardExtensionsSupport.class)
public class SecondIT {
    public static final DropwizardAppExtension<MyServiceConfiguration> RULE = MyTestSuite.DROPWIZARD;
}

But still, Dropwizard restarts before each class.


--
You received this message because you are subscribed to a topic in the Google Groups "dropwizard-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dropwizard-user/cYJnPog0xjU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dropwizard-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/babfebdb-8b89-4c5e-a6a5-750284c7ddf5n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages