micronaut-projects / micronaut-test

Repository for Test Related Utilities for Micronaut
Apache License 2.0
81 stars 61 forks source link

With @MicronautTest, annotation like @Rollback would be helpful #372

Closed Amitbhave closed 3 years ago

Amitbhave commented 3 years ago

Thanks for reporting an issue, please review the task list below before submitting the issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (https://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions.

Task List

Steps to Reproduce

For each integration test, I have to write the code to cleanup database tables in @BeforeEach/ sometimes in @BeforeAll block.

Expected Behaviour

Provide annotation like @Rollback (something like spring provides - @Rollback ), which takes care of transaction rollbacks after each test

Actual Behaviour

@Rollback annotation currently not present in micronaut.

Environment Information

Example Application

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/test/annotation/Rollback.html

alvarosanchez commented 3 years ago

This is already supported:

https://micronaut-projects.github.io/micronaut-test/latest/guide/index.html#_transaction_semantics