When developing a web application SpringBoot dev tools module is handy for speeding up the compile and run loop. However, I could not find any similar feature for integration tests.
More specifically, let's say I have an integration test (annotated with @RunWith(SpringRunner.class)
and @SpringBootTest
) which starts a web server on a random port and tests some of the REST endpoints. I'd like to have an interactive test runner which will not kill the process when a test case fails. Instead, it will wait for changes in the code and will reload and rerun the tests if changes are detected (just like hot swapping in dev tools)
My searches for this feature were not successful, so I'd like to know what will be the fastest way of implementing this feature. Considering Springs popularity is there a reason why there is no widely known way of doing this?
EDIT
Digging a little bit in the source code, I have found the following piece of code.
/**
* Default {@link RestartInitializer} that only enable initial restart when running a
* standard "main" method. Skips initialization when running "fat" jars (included
* exploded) or when running from a test.
*
* @author Phillip Webb
* @author Andy Wilkinson
* @since 1.3.0
*/
public class DefaultRestartInitializer implements RestartInitializer {
private static final Set<String> SKIPPED_STACK_ELEMENTS;
static {
Set<String> skipped = new LinkedHashSet<>();
skipped.add("org.junit.runners.");
skipped.add("org.junit.platform.");
skipped.add("org.springframework.boot.test.");
skipped.add("cucumber.runtime.");
SKIPPED_STACK_ELEMENTS = Collections.unmodifiableSet(skipped);
}
...
From this, I understand that the author explicitly disabled support for testing. Can anyone explain this?