TOPIC 29/6214 MINNOT STARTED

Testing GraphQL, gRPC and WebSocket APIs

Different application programming interfaces (APIs) use different contracts and ways to exchange messages. Learn how GraphQL, gRPC and WebSocket are asked and what to check.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: four ways to order food. With a menu, you point at a set dish and the kitchen sends it. With your own order slip, you write exactly what you want and nothing more. With a kitchen hotline, you phone in a short coded order and get a quick coded reply. With an open line, the kitchen and you keep talking as things change.

Daily List is a to-do list app. Its first application programming interface () worked like the menu: the response followed the requested method, address, parameters and access rules. Now Daily List adds a mobile feed, an internal service and a live shared-list view. Leo, the developer, uses a different style for each.

Tom, the tester, cannot just open an address in a browser anymore. For the feed he writes his own order slip. For the internal service he needs a shared plan of the messages. For the live view he must keep a line open and watch.

These styles are GraphQL, gRPC and WebSocket. The ideas of a good API test still hold: ask, read the answer, check it. The contract, error signals and connection behavior also shape the test.

The picture has a limit. A real kitchen can hear you speak. In these styles, schemas and protocol rules govern the exchange. A bad value may be rejected or handled under stated coercion and default rules.

(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)

PLAIN WORDS · 3 in this section
hotline
a phone line used to give short, quick orders
schemas
formal layouts listing which fields a message must contain
coercion
forcing someone to act by threat or pressure

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Knowing four ways to order food, so a tester picks the right way to ask each kind of application programming interface ().

  1. Menu
  2. Slip
  3. Hotline
  4. Open line
Four ways to order

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
A menu with set dishesAn HTTP request under its method, parameters and response contract
Your own order slipA GraphQL query
A kitchen hotline with coded ordersA gRPC call
An open line to the kitchenA WebSocket

WHERE THIS PICTURE STOPS

  • A real kitchen understands speech, but these styles need strict message shapes.
  • A diner can see the menu, but a tester needs a schema or a shared file first.
  • A WebSocket can fail abruptly instead of closing cleanly.

HOOK

Menu, slip, hotline, open line.

REMEMBER IT THIS WAY

A rule of thumb: if you see this, think that.

Read the operation and message contract, then choose a tool that can send and inspect that exchange.

What each part of the trick stands for
In the trickWhat it stands for
operation and message contractthe service schema, method and message rules
send and inspecta suitable client and readable evidence

Browser address-bar behavior does not identify a protocol; browser apps can use GraphQL and WebSocket clients too.

TELL A FRIEND

Four ways to order food: a menu, your own slip, a hotline and an open line.

OFTEN MIXED UP WITH Designing API tests. test design covers expected behavior and evidence. This lesson adds contract, transport and lifecycle differences.

PRACTISE AND KEEP

Sources for this topic — 11 sources
  1. Market practice

    GraphQL Specification, October 2021 edition ↗ — GraphQL Foundation · GraphQL October2021 §§2.7,6.2.3 Delivery Agnostic,6.4.4 and7.1 selected sections actually read 8 November2026. Selection aliases, request versus field errors, partial data/nonnull propagation and transport/QoS boundaries; not full specification reread.

    Defines GraphQL queries, mutations, subscriptions, the type system and introspection. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: October 2021. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary-source update: GraphQL October2021 §§2.7,6.2.3 Delivery Agnostic,6.4.4 and7.1 selected sections actually read 8 November2026. Selection aliases, request versus field errors, partial data/nonnull propagation and transport/QoS boundaries; not full specification reread.

  2. Market practice

    Introduction to gRPC (grpc.io) ↗ — Cloud Native Computing Foundation (gRPC project) · 8 November2026: primary Introduction Overview/Working with Protocol Buffers read. Protobuf is the default, alternatives exist; .proto/stubs apply to this selected protobuf example, not every serialization.

    Per the search excerpt, a service is defined in a proto file with protocol buffers. There are four kinds of call, including streaming, and a client uses a stub that forwards calls to the server. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary-source update: 8 November2026: primary Introduction Overview/Working with Protocol Buffers read. Protobuf is the default, alternatives exist; .proto/stubs apply to this selected protobuf example, not every serialization.

  3. Market practice

    RFC 6455: The WebSocket Protocol ↗ — Internet Engineering Task Force · RFC6455 December2011 Standards Track; opening overview and §§7.1.2–7.1.6,7.2.3 actually read 8 November2026. Optional code/reason, abnormal closure and client backoff; not automatic application replay.

    Defines the WebSocket opening handshake over HyperText Transfer Protocol (HTTP) followed by message framing over one connection. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: December 2011. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary-source update: RFC6455 December2011 Standards Track; opening overview and §§7.1.2–7.1.6,7.2.3 actually read 8 November2026. Optional code/reason, abnormal closure and client backoff; not automatic application replay.

  4. Market practice

    WebSocket: readyState property (MDN Web Docs) ↗ — Mozilla · 8 November2026: MDN readyState substantive property/constants section read: CONNECTING0,OPEN1,CLOSING2,CLOSED3. This page is not evidence for CloseEvent reason/wasClean.

    Lists the four connection states and says a close event carries a code, a reason and a clean-close flag. Practitioner guidance, not a standard. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary-source update: 8 November2026: MDN readyState substantive property/constants section read: CONNECTING0,OPEN1,CLOSING2,CLOSED3. This page is not evidence for CloseEvent reason/wasClean.

  5. Market practice

    OpenAPI Specification v3.1.0 ↗ — OpenAPI Initiative · OpenAPI3.1.0 Introduction actually read 8 November2026: interface description for HTTP APIs. Not full OpenAPI audit or a generic live-message contract.

    Standard text. Describes paths, operations, parameters, schemas, required properties and responses; the Responses Object holds at least one response code. Search excerpt only. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.

    8 November2026 bounded primary-source update: OpenAPI3.1.0 Introduction actually read 8 November2026: interface description for HTTP APIs. Not full OpenAPI audit or a generic live-message contract.

  6. Market practice

    gRPC core concepts, architecture and lifecycle ↗ — gRPC project · 8 November2026: actual selected primary sections read. Service Definition/four RPC kinds, RPC lifecycle, termination, cancellation and metadata sections read. Ordering is scoped to individual RPC streams; endpoint success can differ; cancellation does not roll back changes. No complete document, installed runtime or security certification.

    Service Definition/four RPC kinds, RPC lifecycle, termination, cancellation and metadata sections read. Ordering is scoped to individual RPC streams; endpoint success can differ; cancellation does not roll back changes. · Checked 2026-11-08

    8 November2026: actual selected primary sections read. Service Definition/four RPC kinds, RPC lifecycle, termination, cancellation and metadata sections read. Ordering is scoped to individual RPC streams; endpoint success can differ; cancellation does not roll back changes. No complete document, installed runtime or security certification.

  7. Market practice

    gRPC Deadlines ↗ — gRPC project · 8 November2026: actual selected primary sections read. Overview, client/server deadlines and selected propagation paragraphs read. Client DEADLINE_EXCEEDED, application responsibility for spawned work; no SDK execution or rollback guarantee. No complete document, installed runtime or security certification.

    Overview, client/server deadlines and selected propagation paragraphs read. Client DEADLINE_EXCEEDED, application responsibility for spawned work; no SDK execution or rollback guarantee. · Checked 2026-11-08

    8 November2026: actual selected primary sections read. Overview, client/server deadlines and selected propagation paragraphs read. Client DEADLINE_EXCEEDED, application responsibility for spawned work; no SDK execution or rollback guarantee. No complete document, installed runtime or security certification.

  8. Market practice

    Protocol Buffers proto3 — Updating a Message Type ↗ — Protocol Buffers project · 8 November2026: actual selected primary sections read. Updating a Message Type: binary wire-unsafe, wire-safe and conditionally safe sections read. Field numbers must not be changed/reused; binary safety is not application or ProtoJSON compatibility. No complete document, installed runtime or security certification.

    Updating a Message Type: binary wire-unsafe, wire-safe and conditionally safe sections read. Field numbers must not be changed/reused; binary safety is not application or ProtoJSON compatibility. · Checked 2026-11-08

    8 November2026: actual selected primary sections read. Updating a Message Type: binary wire-unsafe, wire-safe and conditionally safe sections read. Field numbers must not be changed/reused; binary safety is not application or ProtoJSON compatibility. No complete document, installed runtime or security certification.

  9. Market practice

    RFC8441 — Bootstrapping WebSockets with HTTP/2 ↗ — Internet Engineering Task Force · 8 November2026: actual selected primary sections read. September2018 Standards Track §5 and example read. Extended CONNECT replaces GET bootstrap; Connection/Upgrade headers are not used on HTTP/2. No complete document, installed runtime or security certification.

    September2018 Standards Track §5 and example read. Extended CONNECT replaces GET bootstrap; Connection/Upgrade headers are not used on HTTP/2. · Checked 2026-11-08

    8 November2026: actual selected primary sections read. September2018 Standards Track §5 and example read. Extended CONNECT replaces GET bootstrap; Connection/Upgrade headers are not used on HTTP/2. No complete document, installed runtime or security certification.

  10. Market practice

    WHATWG WebSockets — browser interface and feedback ↗ — WHATWG · 8 November2026: actual selected primary sections read. Living Standard header dated19October2026. Selected §§2,4 and5 read: browser feedback, optional/empty reason, limited failure disclosure and unexposed ping/pong API; not all implementation behavior. No complete document, installed runtime or security certification.

    Living Standard header dated19October2026. Selected §§2,4 and5 read: browser feedback, optional/empty reason, limited failure disclosure and unexposed ping/pong API; not all implementation behavior. · Checked 2026-11-08

    8 November2026: actual selected primary sections read. Living Standard header dated19October2026. Selected §§2,4 and5 read: browser feedback, optional/empty reason, limited failure disclosure and unexposed ping/pong API; not all implementation behavior. No complete document, installed runtime or security certification.

  11. Market practice

    GraphQL security — demand control and introspection ↗ — GraphQL Foundation · 8 November2026: actual selected primary sections read. Demand control, Introspection and Error messages selected passages read. Limits/configuration and introspection access vary; protected error details do not mean no error outcome. No complete document, installed runtime or security certification.

    Demand control, Introspection and Error messages selected passages read. Limits/configuration and introspection access vary; protected error details do not mean no error outcome. · Checked 2026-11-08

    8 November2026: actual selected primary sections read. Demand control, Introspection and Error messages selected passages read. Limits/configuration and introspection access vary; protected error details do not mean no error outcome. No complete document, installed runtime or security certification.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.