zonkyio / embedded-database-spring-test

A library for creating isolated embedded databases for Spring-powered integration tests.
Apache License 2.0
399 stars 37 forks source link

Highlight junit 5 support and required changes todo in documentation #230

Open swapy opened 1 year ago

swapy commented 1 year ago

Thank you very much @tomix26 for this wonderful project. All efforts appreciated.

I would like to suggest an improvement for docs. Can we mention more about Junit 5 support in documentation?

Thanks.

tomix26 commented 1 year ago

JUnit5 should be supported out of the box, including the @RepeatedTest annotation. All testing frameworks supported by Spring are also supported by this library. I could update the code examples from JUnit4 to JUnit5, but I don't find it particularly important. Or would you suggest any other changes to the documentation?

swapy commented 1 year ago

I would suggest adding one more section mentioning example on how to use with Junit5

example, now I have to go with SpringExtension and it works

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("pgsqltest")
@ExtendWith(SpringExtension.class)
@AutoConfigureMockMvc
@AutoConfigureCache
@AutoConfigureEmbeddedDatabase(refresh = AFTER_EACH_TEST_METHOD, provider = AutoConfigureEmbeddedDatabase.DatabaseProvider.ZONKY, type = AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES)
@TestPropertySource(properties = {"spring.config.location=classpath:application-pgsqltest.yml"})
class PersonTestIT {
...
}