Notes
GraphQL basics
GraphQL usually has one endpoint, often slash graphql, and every call is a post. The body holds a query, written in GraphQL's own language, plus variables. The client asks for exactly the fields it wants, here a product's sku and price in cents, and the response mirrors that shape under data. Reading is a query; changing data is a mutation. A typed schema defines every type and field, and it is the contract you test against.
POST /graphql
{
"query": "query P($id: ID!) {
product(id: $id) {
sku priceCents } }",
"variables": {"id": "1"}
}
→ 200
{"data": {"product":
{"sku": "BK-101",
"priceCents": 1250}}} The big difference
Here is the biggest difference for testers. In GraphQL, problems often come back with HTTP status two hundred. Ask for a field that does not exist, and the response has an errors array: cannot query field price on type product. Ask for a product that does not exist, and you may simply get product null. So a test that only checks for two hundred passes on broken calls. Always assert that errors is absent, and that data has what you expect.
ask for a field that does not
exist ("price"):
{"errors": [{"message":
"Cannot query field 'price'
on type 'Product'.",
"locations": [...]}]}
product that does not exist:
{"data": {"product": null}}
many servers: HTTP 200 for both What to test
A GraphQL checklist. Queries: fields, nulls and lists. Mutations: check the data really changed with a follow up query. Wrong or missing variables. No errors array on success. Authorisation per field, since one query can reach many types. Very deep or large queries, which need depth and cost limits. One query causing hundreds of database calls. And whether introspection, which reveals the whole schema, is off in production.
- queries: fields, nulls, lists
- mutations: data really changed
- variables: wrong types, missing
- errors array: absent on success
- authorisation per FIELD, not just per endpoint
- deep or huge queries: depth and cost limits
- N+1: one query, 100s of DB calls
- introspection off in production?
Tools
The good news: GraphQL is still HTTP and JSON, so your existing tools work. In pytest, post the query and variables to slash graphql, then assert errors is not in the body, and check the value under data, product, sku. In REST Assured, the same post, then check errors is null and use a JSON path into data. Postman has a GraphQL mode with schema based autocomplete, and Playwright's request object works too.
# pytest + httpx
r = client.post("/graphql", json={
"query": Q, "variables": {"id": "1"}})
body = r.json()
assert "errors" not in body
assert body["data"]["product"]
["sku"] == "BK-101"
// REST Assured: same post, then
.body("errors", nullValue())
.body("data.product.sku", ...) SOAP basics
SOAP is an older, stricter protocol. Every message is XML inside an envelope with a body. You post the envelope to the service's address, often with a SOAP action header naming the operation, here get product. The service is described by a WSDL file, a machine readable contract listing every operation and its XML types. Tools read the WSDL to generate requests for you.
POST /ws/ProductService Content-Type: text/xml SOAPAction: "getProduct" <soap:Envelope xmlns:soap=...> <soap:Body> <getProduct><id>1</id> </getProduct> </soap:Body> </soap:Envelope> WSDL = machine-readable contract
Testing SOAP
In SOAP, errors come back as a fault element inside the body, with a fault code saying whether the client or the server caused it, and a fault string with the reason. In SOAP one point one, faults usually come with HTTP status five hundred, even for client mistakes. Assert on values with XPath expressions, like get product response slash sku, and validate messages against the XML schema from the WSDL.
errors come back as a Fault: <soap:Fault> <faultcode>soap:Client </faultcode> <faultstring>Unknown id </faultstring> </soap:Fault> (HTTP 500 in 1.1) assert with XPath: //getProductResponse/sku validate against the XSD
SOAP tools
Tools for SOAP. SoapUI, and its commercial version ReadyAPI, import a WSDL and generate every request for you; it remains the classic SOAP testing tool. REST Assured can post XML and assert with has XPath. In Python, the zeep library reads the WSDL and turns each operation into a function call. And Postman can send a raw XML body when you just need a quick check.
- SoapUI / ReadyAPI: import the WSDL, get every request
- REST Assured: post the XML, then XPath assertions: .body(hasXPath("//sku", equalTo("BK-101")))
- Python: zeep reads the WSDL and gives you functions
- Postman: raw XML body works
Common mistakes
Mistakes with these styles. In GraphQL: checking only for two hundred, skipping depth and cost tests, and checking authorisation only at the endpoint instead of per field. In SOAP: comparing XML as plain strings, which breaks on whitespace and namespace prefixes, and ignoring the WSDL, which already gives you the contract. In both: forgetting negative tests, which matter as much as with REST.
- GraphQL: only checking 200
- GraphQL: no depth/cost tests
- GraphQL: authZ per endpoint only
- SOAP: string-comparing XML (whitespace, namespaces)
- SOAP: ignoring the WSDL
- both: no negative tests
Say it like this
In the interview: GraphQL has one endpoint, the client chooses the fields, and errors often arrive inside a two hundred response, so I always assert that the errors array is absent and check the data. I test variables, nulls, mutations with follow up queries, authorisation per field, and depth and cost limits. For SOAP, messages are XML envelopes described by a WSDL; I check faults and assert with XPath.
- "One endpoint, client-chosen
- fields, and errors often in a 200 body, so I always assert
- the errors array is absent and check data. I test variables, nulls, mutations with follow-up queries, per-field authZ and depth or cost limits. SOAP: XML envelopes, WSDL contract, faults and XPath checks."