-
-
Notifications
You must be signed in to change notification settings - Fork 970
Expand integration test coverage #15348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.0.x
Are you sure you want to change the base?
Conversation
- Add ServiceSpec with 25 tests covering service injection, transactions, scoping, and Spring bean integration - Add TestService with transactional methods and conditional logic - Add Counter domain class for service state testing - Tests verify @transactional behavior, rollback scenarios, and service-to-service dependencies
- Add DomainEventsSpec with 37 tests for GORM event lifecycle - Tests beforeInsert, afterInsert, beforeUpdate, afterUpdate, beforeDelete, afterDelete, and onLoad events - Add ConstraintsSpec with tests for validation constraints - Tests nullable, blank, size, range, email, URL, matches patterns - Includes custom validator and shared constraints testing
- Add ContentNegotiationSpec with 21 tests for format handling - Tests JSON, XML, HTML responses based on Accept headers - Tests format parameter, extension-based negotiation - Add UrlMappingsSpec with 20 tests for routing - Tests path variables, constraints, HTTP methods, redirects - Includes optional parameters and format extension support
- Add SpringEventsSpec with 19 tests for ApplicationEvent handling - Tests synchronous and async event publishing/listening - Tests event inheritance and multiple listeners - Add CachingSpec with 20 tests for @Cacheable, @CacheEvict - Tests cache hits/misses, eviction strategies, conditional caching - Includes cache manager integration and TTL behavior
- Add AsyncPromisesSpec with 20 tests for Grails async features - Tests Promise.task, Promise.onComplete/onError callbacks - Tests PromiseList, PromiseMap, and timeout handling - Add InterceptorSpec with 20 tests for controller interceptors - Tests before/after/afterView interceptor phases - Tests matching patterns, model modification, request blocking
- Add DataBindingSpec with 20 tests for request parameter binding - Tests type coercion, nested objects, collections, dates - Add CodecsSpec with 15 tests for encoding/decoding - Tests HTML, URL, Base64, JavaScript, MD5, SHA codecs - Add I18nSpec with 17 tests for internationalization - Tests message resolution, locale switching, pluralization - Includes message bundles for English, French, German
- Add TagLibSpec with 25 tests for GSP tag libraries - Tests form tags, iteration tags, conditional tags, link tags - Tests custom tag implementation and encoding - Add CommandObjectDISpec with tests for dependency injection - Tests @Autowired services in command objects - Tests validation with injected dependencies
- Add ErrorHandlingSpec with 23 tests for HTTP error responses - Tests all common HTTP status codes (400-503) - Tests JSON error payloads and custom error headers - Add RequestResponseSpec with 20 tests for HTTP handling - Tests headers, cookies, sessions, request info - Add CorsAdvancedSpec with 16 tests for CORS headers - Tests preflight requests and cross-origin scenarios - Add FileUploadSpec with 15 tests for multipart uploads - Tests single/multiple files, validation, content processing
- Add GormCriteriaQueriesSpec with tests for criteria builder - Add GormCascadeOperationsSpec for cascade save/delete behavior - Add GormDataServicesSpec for GORM Data Services - Add GormEventsSpec for domain event handling - Add ValidationConstraintsSpec for constraint testing - Add FieldsValidationSpec for form field validation - Add ScaffoldingFunctionalSpec for scaffolded CRUD UI - Add scaffolding-fields module for fields plugin testing - Updates build.gradle with necessary dependencies
- Add GspTagLibSpec for GSP layout and tag integration - Tests g:layoutHead, g:layoutBody, g:layoutTitle tags - Add MicronautContextSpec for Micronaut bean integration - Add MicronautQualifierSpec for qualifier-based injection - Tests Micronaut HTTP client and bean scoping
- Add AsyncEventsSpec with tests for event-driven architecture - Tests publisher/subscriber patterns with async execution - Update existing services for better test isolation - Enhance BookSubscriber for async event handling
- Add GormAdvancedSpec with 53 tests for GORM queries - Tests criteria queries, HQL, dynamic finders - Tests projections, aggregations, and pagination - Tests domain relationships (one-to-many, many-to-many) - Includes cascade operations and orphan removal testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Add ASF license headers to 19 GSP view files that were missing them, fixing the RAT audit failure in CI.
- UserSpec: Make test self-contained by creating test data in given block instead of relying on Bootstrap data that may not exist in test context - FieldsValidationSpec: Use timestamp-based email for uniqueness and increase waitFor timeout for more reliable test execution - ValidationFunctionalSpec: Use flexible waitFor conditions that handle scaffolded templates which may not have expected CSS error classes
- FieldsValidationSpec: Add /author/save and /book/save to expected URLs, use proper field accessors (titleField.value() instead of title =), fix property assignment syntax (name.value() instead of name =) - CustomTemplatesSpec: Use correct field names (firstNameField, lastNameField, emailField) and add flexible URL checking for form submissions - FieldTypesSpec: Remove invalid jQuery :contains() CSS selector, use standard CSS attribute selector instead - PaginationSpec: Use dataTable from base ScaffoldListPage instead of undefined employeeTable/departmentTable - ScaffoldCreatePage: Improve createButton selector to try multiple patterns - EmployeePages/DepartmentPages: Add table aliases and make 'at' checks more flexible for title matching
|
Appears to have a small impact the the CI workflows, overall. |
Summary
This PR significantly expands the integration test coverage in the
grails-test-examplesmodules, adding approximately 479 new integration tests across multiple Grails 7 feature areas.Test Coverage Added
Core Framework Tests
Additional Module Tests
Files Changed