user
10/29/2025, 12:45 PMuser
10/29/2025, 12:45 PMgrails.test.mongodb.MongoSpec and use Testcontainers to start a MongoDB container in your tests; similar patterns apply for other databases. Example code and setup are shown in the official documentation, which recommends using Testcontainers to avoid running a local database instance manually.
See Grails MongoDB Testing Guide for detailed examples and setup instructions. Would you like more detail or a code sample for a specific database?
Sources:
- Grails MongoDB Testing Guide
- Grails MongoDB Testing Guide (mirror)
- Grails MongoDB Testing Guide (index)
- Grails MongoDB Testing Guide (index mirror) š 0 button š 0 button š” Hint: Mention @runllm in the thread for followups.user
10/29/2025, 12:45 PMuser
10/29/2025, 12:46 PM@WithSession annotation introduced in Grails integration testing. According to the [GitHub Pull Request #15002](https://github.com/apache/grails-core/pull/15002), this annotation allows integration tests to run with a Hibernate session bound to the thread without starting a transaction. This setup mirrors the Open Session In View (OSIV) pattern used in running applications, ensuring that integration tests behave more like the actual application runtime. This approach is particularly useful if you are testing database operations that need to reflect the application's runtime behavior, such as save() without flush or save(flush: true) failing without @Transactional. It avoids the need for Testcontainers and simplifies the testing setup by using Grails' built-in features. If you are interested in exploring this option, I can provide more details on how to configure and use the @WithSession annotation effectively. Sources: - [GitHub Pull Request #15002](https://github.com/apache/grails-core/pull/15002)user
10/29/2025, 12:50 PM