Add Comprehensive GraphQL API Tests #81
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Comprehensive GraphQL API Tests
Summary
This PR adds a complete test suite for the GraphQL API layer of the Spring Boot RealWorld Example App. The tests cover mutations (user registration, article CRUD, comments), queries (articles, profiles, feeds), data fetchers, and error handling scenarios. The test structure follows the existing REST API test patterns and includes 10 new test classes with comprehensive documentation.
Review & Testing Checklist for Human
Test Plan
./gradlew test --tests "io.spring.api.*"to verify existing REST API tests still pass ✅ (confirmed passing)./gradlew test --tests "io.spring.graphql.*"to see current test failuresNotes
Test Files Added:
GraphQLTestBase.java,GraphQLIntegrationTestBase.javaUserMutationTest.java,ArticleMutationTest.java,CommentMutationTest.javaArticleQueryTest.java,ProfileQueryTest.javaArticleDatafetcherTest.javaGraphQLErrorHandlingTest.javaREADME.mdwith test patterns and usageWhy Tests Are Failing:
The tests use
@SpringBootTestwithDgsAutoConfigurationand specific component classes, but the Spring context is not properly initializing all required beans (particularlyNoSuchBeanDefinitionExceptionandUnsatisfiedDependencyExceptionerrors). The DGS framework testing approach may need adjustment - possibly requiring full application context or different test slice annotations.Session Info: