SlideShare a Scribd company logo
Introduction to
GraphQL Testing
Shivam Singh (Software Consultant)
Test Automation Competency
Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
 Punctuality
Join the session 5 minutes prior to the session start time. We
start on time and conclude on time!
 Feedback
Make sure to submit a constructive feedback for all sessions as
it is very helpful for the presenter.
 Silent Mode
Keep your mobile devices in silent mode, feel free to move out
of session in case you need to attend an urgent call.
 Avoid Disturbance
Avoid unwanted chit chat during the session.
1. Introduction
• Example
• Working Architecture
2. What is GraphQL?
3. Why use GraphQL?
4. Rest Vs GraphQL
5. Components of GraphQL
6. Why GraphQL API is the perfect data layer for your backend
7. Why test GraphQL?
8. Advantages of GraphQL
9. Best Practices for GraphQL Testing
10. Effective testing approach in GraphQL
11. Testing GraphQL Tools
12. Demo/QnA
Introduction
Introduction
In the world of web development, there’s this powerful tool called GraphQL. It's like being your
own chef in a restaurant kitchen, where you can order precisely what you want and how you
want it. Let's take a peek at this cool way of getting data from the web, where you're in charge of
your data order, getting only what you need, just how you want it, and all from one place!
Let's Understand with an example:-
User
Id
Name
age
gender
Address
Id
Street
City
Country
Job
Id
Organization
Department
Join_Date
Salary
Id
Type
Pay
Tax
HomeScreen
Name
Department
City
SalaryPay
User
Id
Name
age
gender
Address
Id
Street
City
Country
Job
Id
Organization
Department
Join_Date
Salary
Id
Type
Pay
Tax
HomeScreen
Name
Department
City
SalaryPay
Database
Legacy
System
GRAPHQL
Query to single GraphQL End
point asking exactly detail you
need
What is GraphQL ?
• GraphQL is a query language and server-side runtime
for fulfilling those queries on your existing data.
• GraphQL isn't tied to any specific database or
storage engine and is instead backed by your existing
code and data.
• GraphQL was developed by Facebook in 2012 . After
that, it was publicly released in 2015 at the
React.js conference.
• It was developed to optimize RESTful API calls and
provides a flexible, robust, and more efficient
alternative to REST.
Why use GraphQL ?
• We already had an API named REST for data communication, which follows a clear and well-structured resource-
oriented approach.
• It also provides some great ideas such as stateless servers, structured access to resources, etc.
• REST is not so flexible to cope up with the rapidly changing requirements of the clients that access them.
• In this case, when the data gets more complex, the routes get longer. Sometimes, it is challenging to fetch the
data with a single request. That's why we use GraphQL.
Rest vs GraphQL
Mutation
Type Query
type Query{
user(id: ID): User
department(id: ID): Dept
users: [User]
dept: [Depatment]
}
type Mutation {
AddUser(name: String)
AddDepart(name: String)
}
type User{
id:String!
name:String!
age:Int
Address:String
}
Components of GraphQL
Resolvers
User: {
type: UserType,
args: {id: {type: GraphQLID}},
resolve(parent, args){
return Movie.findById(args.id);
}
}
Query in GraphQL
• In simple terms, queries are ways to get data from the server. No more over or under
fetching, you get what exactly you ask. It is a read-only fetch operation.
• In the REST world, queries are equivalent to how you’d use Request with a payload to
get a response from the server.
Example:-
• the schema allows the users to query for four different types of data:
• A Book with a valid ID.
• An Author with a valid ID.
• To fetch all the Books, that returns a data type LIST.
• To fetch all the Authors, that returns a data type LIST.
type Query {
book(id: int): Books
author(id: int): Authors
books:[Books]
author: [Authors]
}
Mutation in GraphQL
• The mutations are equivalent to how you’d use the CRUD operation
along with Verbs such as GET, POST, PUT, PATCH and DELETE in the
REST world.
• In GraphQL, It will always be a POST call. It's a write followed by fetch
operation.
Example:-
See the two mutations that are shown for Adding a Book that should return
a new Book for us and Add Author that should return a new Author:
type Mutation {
addBook(name: String!, authorId: int): Books
addAuthor(name: String!): Author
}
Why GraphQL API Is The Perfect Data Layer For Your Backend
• One unified endpoint for your backend
• Improved application performance
• Improved system reliability
• Better developer experience
Why Test GraphQL?
• Schema Changes: Ensure modifications to the API schema don't break
existing functionality.
• Functional Validation: Confirm that queries, mutations, and subscriptions
return expected results and perform desired operations.
• Performance Assurance: Assess API performance under complex
queries and data loads.
• Security Checks: Identify and fix vulnerabilities like injection attacks,
unauthorized access, and data exposure.
• Error Handling: Verify graceful error handling, ensuring informative
responses for clients.
Why
Advantages of GraphQL
• GraphQL is faster.
• No over-fetching and under-fetching problems
• Hierarchical Structure
• Defines a data shape
• Strongly typed
02
01
Best practices To Test GraphQL
03
• Empty arrays
• Maximum/minimum values
• Invalid query handling
• Authentication failures
• Authorization denials
Edge Cases and Error
04
• Missing required fields
• Incorrect argument types
• Violating custom validations
• Field-level validations
• Input object validations
Query and Mutation
• Concurrent request handling
• Response time evaluation
• Batched query performance
• Caching effectiveness
Performance and Load
• Authenticated and unauthenticated requests
• Valid and invalid tokens
• Different user roles and permissions
• Accessing restricted resources
Test Authentication
Testing GraphQL Tools
Effective testing approach in
GraphQL
GraphQL Explorer (GraphiQL)
Test GraphQL on Postman
DEMO
Q&A
Testing Graph QL Presentation (Test Automation)

More Related Content

PPTX
GraphQL API Gateway and microservices
PDF
Adding GraphQL to your existing architecture
PPTX
Introduction to Graph QL
PPT
Graphql presentation
PPTX
CONDG April 23 2020 - Baskar Rao - GraphQL
PDF
How easy (or hard) it is to monitor your graph ql service performance
PDF
GraphQL with .NET Core Microservices.pdf
PPTX
GraphQL-ify your APIs - Devoxx UK 2021
GraphQL API Gateway and microservices
Adding GraphQL to your existing architecture
Introduction to Graph QL
Graphql presentation
CONDG April 23 2020 - Baskar Rao - GraphQL
How easy (or hard) it is to monitor your graph ql service performance
GraphQL with .NET Core Microservices.pdf
GraphQL-ify your APIs - Devoxx UK 2021

Similar to Testing Graph QL Presentation (Test Automation) (20)

PDF
What is GraphQL: Best Practices
PPTX
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
DOCX
How to Deploy a GraphQL API A Comprehensive Guide.docx
PPTX
GraphQL API Crafts presentation
PPTX
GraphQL research summary
PPTX
Create GraphQL server with apolloJS
PDF
Graphql
PDF
Roundtable_-_API_Research__Testing_Tools.pdf
PPTX
Introduction to GraphQL Presentation.pptx
PDF
Hands On - GraphQL
DOCX
Graphql for Frontend Developers Simplifying Data Fetching.docx
PDF
Real Time Serverless Polling App
PPTX
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
PPTX
GraphQL.net
PDF
Tutorial: Building a GraphQL API in PHP
PDF
The Apollo and GraphQL Stack
PDF
Sashko Stubailo - The GraphQL and Apollo Stack: connecting everything together
PDF
Deploying GraphQL Services as Managed APIs
PPTX
Introduction to GraphQL
PDF
Camunda GraphQL Extension (09/2017 Berlin)
What is GraphQL: Best Practices
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
How to Deploy a GraphQL API A Comprehensive Guide.docx
GraphQL API Crafts presentation
GraphQL research summary
Create GraphQL server with apolloJS
Graphql
Roundtable_-_API_Research__Testing_Tools.pdf
Introduction to GraphQL Presentation.pptx
Hands On - GraphQL
Graphql for Frontend Developers Simplifying Data Fetching.docx
Real Time Serverless Polling App
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
GraphQL.net
Tutorial: Building a GraphQL API in PHP
The Apollo and GraphQL Stack
Sashko Stubailo - The GraphQL and Apollo Stack: connecting everything together
Deploying GraphQL Services as Managed APIs
Introduction to GraphQL
Camunda GraphQL Extension (09/2017 Berlin)
Ad

More from Knoldus Inc. (20)

PPTX
Angular Hydration Presentation (FrontEnd)
PPTX
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
PPTX
Self-Healing Test Automation Framework - Healenium
PPTX
Kanban Metrics Presentation (Project Management)
PPTX
Java 17 features and implementation.pptx
PPTX
Chaos Mesh Introducing Chaos in Kubernetes
PPTX
GraalVM - A Step Ahead of JVM Presentation
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
Nomad by HashiCorp Presentation (DevOps)
PPTX
DAPR - Distributed Application Runtime Presentation
PPTX
Introduction to Azure Virtual WAN Presentation
PPTX
Introduction to Argo Rollouts Presentation
PPTX
Intro to Azure Container App Presentation
PPTX
Insights Unveiled Test Reporting and Observability Excellence
PPTX
Introduction to Splunk Presentation (DevOps)
PPTX
Code Camp - Data Profiling and Quality Analysis Framework
PPTX
AWS: Messaging Services in AWS Presentation
PPTX
Amazon Cognito: A Primer on Authentication and Authorization
PPTX
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
PPTX
Managing State & HTTP Requests In Ionic.
Angular Hydration Presentation (FrontEnd)
Optimizing Test Execution: Heuristic Algorithm for Self-Healing
Self-Healing Test Automation Framework - Healenium
Kanban Metrics Presentation (Project Management)
Java 17 features and implementation.pptx
Chaos Mesh Introducing Chaos in Kubernetes
GraalVM - A Step Ahead of JVM Presentation
Nomad by HashiCorp Presentation (DevOps)
Nomad by HashiCorp Presentation (DevOps)
DAPR - Distributed Application Runtime Presentation
Introduction to Azure Virtual WAN Presentation
Introduction to Argo Rollouts Presentation
Intro to Azure Container App Presentation
Insights Unveiled Test Reporting and Observability Excellence
Introduction to Splunk Presentation (DevOps)
Code Camp - Data Profiling and Quality Analysis Framework
AWS: Messaging Services in AWS Presentation
Amazon Cognito: A Primer on Authentication and Authorization
ZIO Http A Functional Approach to Scalable and Type-Safe Web Development
Managing State & HTTP Requests In Ionic.
Ad

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Cloud computing and distributed systems.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Approach and Philosophy of On baking technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
A Presentation on Artificial Intelligence
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
NewMind AI Weekly Chronicles - August'25 Week I
Unlocking AI with Model Context Protocol (MCP)
Dropbox Q2 2025 Financial Results & Investor Presentation
The AUB Centre for AI in Media Proposal.docx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Cloud computing and distributed systems.
Advanced methodologies resolving dimensionality complications for autism neur...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Approach and Philosophy of On baking technology
“AI and Expert System Decision Support & Business Intelligence Systems”
A Presentation on Artificial Intelligence
Agricultural_Statistics_at_a_Glance_2022_0.pdf

Testing Graph QL Presentation (Test Automation)

  • 1. Introduction to GraphQL Testing Shivam Singh (Software Consultant) Test Automation Competency
  • 2. Lack of etiquette and manners is a huge turn off. KnolX Etiquettes  Punctuality Join the session 5 minutes prior to the session start time. We start on time and conclude on time!  Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter.  Silent Mode Keep your mobile devices in silent mode, feel free to move out of session in case you need to attend an urgent call.  Avoid Disturbance Avoid unwanted chit chat during the session.
  • 3. 1. Introduction • Example • Working Architecture 2. What is GraphQL? 3. Why use GraphQL? 4. Rest Vs GraphQL 5. Components of GraphQL 6. Why GraphQL API is the perfect data layer for your backend 7. Why test GraphQL? 8. Advantages of GraphQL 9. Best Practices for GraphQL Testing 10. Effective testing approach in GraphQL 11. Testing GraphQL Tools 12. Demo/QnA
  • 5. Introduction In the world of web development, there’s this powerful tool called GraphQL. It's like being your own chef in a restaurant kitchen, where you can order precisely what you want and how you want it. Let's take a peek at this cool way of getting data from the web, where you're in charge of your data order, getting only what you need, just how you want it, and all from one place!
  • 6. Let's Understand with an example:- User Id Name age gender Address Id Street City Country Job Id Organization Department Join_Date Salary Id Type Pay Tax HomeScreen Name Department City SalaryPay
  • 8. What is GraphQL ? • GraphQL is a query language and server-side runtime for fulfilling those queries on your existing data. • GraphQL isn't tied to any specific database or storage engine and is instead backed by your existing code and data. • GraphQL was developed by Facebook in 2012 . After that, it was publicly released in 2015 at the React.js conference. • It was developed to optimize RESTful API calls and provides a flexible, robust, and more efficient alternative to REST.
  • 9. Why use GraphQL ? • We already had an API named REST for data communication, which follows a clear and well-structured resource- oriented approach. • It also provides some great ideas such as stateless servers, structured access to resources, etc. • REST is not so flexible to cope up with the rapidly changing requirements of the clients that access them. • In this case, when the data gets more complex, the routes get longer. Sometimes, it is challenging to fetch the data with a single request. That's why we use GraphQL.
  • 11. Mutation Type Query type Query{ user(id: ID): User department(id: ID): Dept users: [User] dept: [Depatment] } type Mutation { AddUser(name: String) AddDepart(name: String) } type User{ id:String! name:String! age:Int Address:String } Components of GraphQL Resolvers User: { type: UserType, args: {id: {type: GraphQLID}}, resolve(parent, args){ return Movie.findById(args.id); } }
  • 12. Query in GraphQL • In simple terms, queries are ways to get data from the server. No more over or under fetching, you get what exactly you ask. It is a read-only fetch operation. • In the REST world, queries are equivalent to how you’d use Request with a payload to get a response from the server. Example:- • the schema allows the users to query for four different types of data: • A Book with a valid ID. • An Author with a valid ID. • To fetch all the Books, that returns a data type LIST. • To fetch all the Authors, that returns a data type LIST. type Query { book(id: int): Books author(id: int): Authors books:[Books] author: [Authors] }
  • 13. Mutation in GraphQL • The mutations are equivalent to how you’d use the CRUD operation along with Verbs such as GET, POST, PUT, PATCH and DELETE in the REST world. • In GraphQL, It will always be a POST call. It's a write followed by fetch operation. Example:- See the two mutations that are shown for Adding a Book that should return a new Book for us and Add Author that should return a new Author: type Mutation { addBook(name: String!, authorId: int): Books addAuthor(name: String!): Author }
  • 14. Why GraphQL API Is The Perfect Data Layer For Your Backend • One unified endpoint for your backend • Improved application performance • Improved system reliability • Better developer experience
  • 15. Why Test GraphQL? • Schema Changes: Ensure modifications to the API schema don't break existing functionality. • Functional Validation: Confirm that queries, mutations, and subscriptions return expected results and perform desired operations. • Performance Assurance: Assess API performance under complex queries and data loads. • Security Checks: Identify and fix vulnerabilities like injection attacks, unauthorized access, and data exposure. • Error Handling: Verify graceful error handling, ensuring informative responses for clients. Why
  • 16. Advantages of GraphQL • GraphQL is faster. • No over-fetching and under-fetching problems • Hierarchical Structure • Defines a data shape • Strongly typed
  • 17. 02 01 Best practices To Test GraphQL 03 • Empty arrays • Maximum/minimum values • Invalid query handling • Authentication failures • Authorization denials Edge Cases and Error 04 • Missing required fields • Incorrect argument types • Violating custom validations • Field-level validations • Input object validations Query and Mutation • Concurrent request handling • Response time evaluation • Batched query performance • Caching effectiveness Performance and Load • Authenticated and unauthenticated requests • Valid and invalid tokens • Different user roles and permissions • Accessing restricted resources Test Authentication
  • 21. Test GraphQL on Postman
  • 22. DEMO
  • 23. Q&A