You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to the graphql-specifications repository! This project demonstrates how to test a GraphQL service built with HotChocolate using specifications and behavior-driven approaches with Reqnroll.
Why Specifications?
Specifications provide a structured, human-readable way to define and verify your GraphQL API’s behavior. By aligning tests with clear specifications, you can:
Ensure consistent and reliable API behavior.
Make tests easy to understand for both technical and non-technical stakeholders.
Promote collaboration and a shared understanding of the API’s functionality.
Repository Features
GraphQL Service: Built using HotChocolate, showcasing a sample domain.
Specifications: Written in plain language to describe API behavior.
Reqnroll Integration: Testing GraphQL queries and mutations against the specifications.
Implemented Scenarios:
Getting all books.
Searching for books by title, retrieving details, and checking stock.
Logging in as an owner or customer, with scope validation in the bearer token.
Adding books (restricted to logged-in store owners).
Getting Started
Follow these steps to explore and use this repository:
The CustomWebApplicationFactory class is used to create a custom WebApplicationFactory for integration tests. This class is used to configure the test server with the required services and settings. It is also used to override registered services, in this case the StockService.