Conversation
There was a problem hiding this comment.
Pull request overview
This PR significantly expands integration test coverage for the Grails test examples, adding approximately 426 new integration tests across multiple Grails 7 feature areas, increasing the total test count from ~74 to 500+ tests.
Changes:
- Added comprehensive integration tests for core Grails features including services, domain events, constraints, content negotiation, URL mappings, Spring events, caching, async operations, interceptors, data binding, codecs, i18n, TagLibs, and more
- Implemented supporting infrastructure including new controllers, domain classes, services, and views to facilitate testing
- Enhanced the gorm module with scaffolding tests, GORM data services, and field validation tests
- Added test isolation improvements for async event testing with reset methods and relative assertions
Reviewed changes
Copilot reviewed 147 out of 202 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| gorm/src/integration-test/groovy/gorm/FieldsValidationSpec.groovy | New Geb-based functional test spec for fields plugin validation error display |
| gorm/grails-app/views/*.gsp | Standard error, index, and notFound GSP views for the gorm module |
| gorm/grails-app/services/gorm/BookDataService.groovy | GORM data service demonstrating auto-generated CRUD and custom queries |
| gorm/grails-app/i18n/messages.properties | Standard Grails validation and UI messages |
| gorm/grails-app/domain/gorm/*.groovy | Enhanced Book and Author domain classes with relationships and constraints |
| gorm/grails-app/controllers/gorm/*.groovy | Scaffolded controllers and URL mappings for Author and Book |
| gorm/build.gradle | Changed scaffolding and fields dependencies from runtimeOnly to implementation |
| async-events-pubsub-demo/src/main/groovy/pubsub/demo/BookSubscriber.groovy | Added thread-safe list and reset method for test isolation |
| async-events-pubsub-demo/src/integration-test/groovy/pubsub/demo/*.groovy | Enhanced existing tests with setup/teardown and added new async events test spec |
| async-events-pubsub-demo/grails-app/services/pubsub/demo/TotalService.groovy | Added reset method for clearing accumulated state |
| app1/src/main/groovy/functionaltests/springevents/*.groovy | New event classes for Spring events testing |
| app1/grails-app/views/tagLibTest/*.gsp | GSP views for TagLib integration testing |
| app1/grails-app/views/contentNegotiation/*.gsp | GSP views for content negotiation testing |
| app1/grails-app/services/functionaltests//.groovy | Services for testing DI, caching, async operations, and Spring events |
| app1/grails-app/i18n/messages*.properties | Added custom i18n test messages for English, French, and German |
| app1/grails-app/domain/functionaltests//.groovy | Domain classes for testing events, constraints, binding, and GORM queries |
| app1/grails-app/controllers/functionaltests//.groovy | Controllers and interceptors for testing various Grails features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Appears to have a small impact the the CI workflows, overall. |
...les/app1/grails-app/controllers/functionaltests/binding/AdvancedDataBindingController.groovy
Outdated
Show resolved
Hide resolved
...les/app1/grails-app/controllers/functionaltests/binding/AdvancedDataBindingController.groovy
Outdated
Show resolved
Hide resolved
...test-examples/app1/grails-app/controllers/functionaltests/caching/CacheTestController.groovy
Show resolved
Hide resolved
|
@jdaugherty This PR was so big so I created #15359 (from this PR branch) to give my thoughts. |
b50523e to
66322fc
Compare
…tures Add 250+ new integration tests covering previously untested Grails features: Services & Transactions: - ServiceSpec with 25 tests for service injection, transactions, scoping Domain Events & Validation: - DomainEventsSpec with 37 tests for GORM event lifecycle - ConstraintsSpec for validation constraints testing Content Negotiation & URL Mappings: - ContentNegotiationSpec with 21 tests for format handling - UrlMappingsSpec with 20 tests for routing Spring Events & Caching: - SpringEventsSpec with 19 tests for ApplicationEvent handling - CachingSpec with 20 tests for @Cacheable, @CacheEvict Async/Promises & Interceptors: - AsyncPromisesSpec with 20 tests for Grails async features - InterceptorSpec with 20 tests for controller interceptors Data Binding, Codecs & i18n: - DataBindingSpec with 20 tests for request parameter binding - CodecsSpec with 15 tests for encoding/decoding - I18nSpec with 17 tests for internationalization TagLib & Command Objects: - TagLibSpec with 25 tests for GSP tag libraries - CommandObjectDISpec for dependency injection in command objects HTTP Handling: - ErrorHandlingSpec with 23 tests for HTTP error responses - RequestResponseSpec with 20 tests for HTTP handling - CorsAdvancedSpec with 16 tests for CORS headers - FileUploadSpec with 15 tests for multipart uploads GORM Advanced: - GormAdvancedSpec with 53 tests for criteria queries, HQL, relationships - GormCriteriaQueriesSpec, GormCascadeOperationsSpec, GormDataServicesSpec GSP Layout & Micronaut: - GspTagLibSpec for GSP layout and tag integration - MicronautContextSpec, MicronautQualifierSpec for Micronaut bean integration Async Events: - AsyncEventsSpec for event-driven architecture testing
- Add missing Apache License headers to 19 GSP view files - Fix UserSpec to be self-contained with test data in given block - Fix FieldsValidationSpec to use timestamp-based email for uniqueness - Fix ValidationFunctionalSpec to handle scaffolded templates - Fix functional test failures in gorm and scaffolding-fields modules - Improve page object selectors for test stability
- Add waitFor assertions for asynchronous test operations - Fix assertions to handle timing variations in CI environments - Improve test stability for ValidationFunctionalSpec - Improve test stability for RelationshipsFunctionalSpec - Update controllers and services for better test isolation - Various code quality improvements across test examples
Add AdvancedCachingService with 15 unit tests covering: - Null value caching behavior - Exception handling (exceptions not cached) - Collection caching (List and Map) - Custom key caching with closures - Cache eviction scenarios Also includes: - AdvancedCachingController for HTTP endpoints - AdvancedCachingIntegrationSpec for integration tests - UrlMappings for new controller endpoints
Replace implicit mass assignment (new Domain(params)) with explicit field binding using params.subMap() and class-level bindParams fields across all grails-test-examples controllers and test specs. This change ensures: - Explicit control over which fields are bound - Clear visibility of bindable fields in each controller - Protection against unwanted parameter binding Updated 12 files across app1, hibernate5, and mongodb examples.
…config, and plugins Add 132 new integration tests covering previously untested Grails features: Multiple Datasources (27 tests): - DatasourceSwitchingSpec: Datasource isolation, CRUD ops, dynamic finders - CrossDatasourceTransactionSpec: Chained and nested transactions External Configuration (48 tests): - EnvironmentConfigurationSpec: Environment detection, profile-specific config - ConfigurationPrioritySpec: Property source priority, placeholder resolution Plugin System (57 tests): - PluginLifecycleSpec: Plugin registration, configuration, metadata - PluginLoadOrderSpec: loadAfter declarations, plugin ordering - PluginDependencySpec: Dependencies, configuration merging, bean registration
…verage - Expand FieldsValidationSpec from 10 to 22 tests with proper validation - Expand PaginationSpec from 14 to 26 tests covering sorting and pagination - Expand ValidationFunctionalSpec from 20 to 33 tests for all constraint types - Expand RelationshipsFunctionalSpec from 16 to 30 tests for relationships - Remove all '// TODO: Not fully implemented' markers - Add missing micronaut-http-client dependency to cache module - Fix AdvancedDataBindingController to use bindData() for collections
Interceptor Advanced Matching (app1): - Namespace-based matching, HTTP method matching, action exclusion patterns - Multiple match rules with OR logic, combined criteria and ordering GORM Where Query Advanced (gorm): - Batch updateAll()/deleteAll() operations - IN, NOT IN, LIKE, ILIKE operators - DetachedCriteria reuse and composition - Pagination with where queries Flash/Chain/Forward (app1): - Flash scope retention across redirects, flash.now for same-request - chain() model accumulation, forward() same-request dispatch Transaction Propagation (gorm): - REQUIRES_NEW, MANDATORY, SUPPORTS propagation - rollbackFor and noRollbackFor rules - Programmatic withTransaction/withNewTransaction
- Restore FlashChainForwardSpec with cookie-enabled HTTP client (session cookies required for flash scope and chain model) - Use proper JSON rendering in AdvancedCachingController - Add UUID to list cache data for eviction verification - Update AdvancedCachingServiceSpec to use startsWith for list assertions - Simplify timing interceptor test to avoid async race condition
309347c to
b1389e7
Compare
jdaugherty
left a comment
There was a problem hiding this comment.
@matrei reviewed this rather well in the other PR that's been merged into this branch. I'm ok with these so I say merge them.


Summary
This PR significantly expands the integration test coverage in the
grails-test-examplesmodules, adding approximately 1,066 new integration tests across multiple Grails 7 feature areas.Test Coverage Summary