What You Will Learn
This extended API testing course covers advanced authentication, security testing, Java-based automation with RestAssured, and CI/CD integration. Each module includes a "Why This Module" explanation connecting it to your career growth and real-world testing scenarios.
- HTTP Methods —
GET,POST,PUT,DELETE,PATCH: each verb has a specific purpose and expected behavior - Status Code Categories — 2xx success, 4xx client errors, 5xx server errors; what each means for testing
- Authentication vs. Authorization — "Who are you?" vs. "Are you allowed to do this?" — two separate checks
- API Key Authentication — a static secret your app sends with every request, like a VIP pass
- Basic Authentication — username and password encoded in
Base64, the oldest method still in use - Advanced Auth Preview — Bearer tokens, OAuth 2.0, and JWT at a high level (deep dive in next modules)
- SSL/TLS and HTTPS — the encrypted tunnel that protects API calls in transit from eavesdroppers
- Request/Response Model —
headers,body,Content-Type; understanding the full envelope - Standard Headers —
Accept,Content-Type,Authorization: the must-know headers for every tester - API Documentation — reading OpenAPI/Swagger specs to understand what you need to test
- Bearer Token structure — the format, according to RFC 6750, and what it contains
- Token placement — always in
Authorization: Bearer <token>header, never in the URL - Token lifecycle — how it's generated, stored, validated, and eventually expires
- API Key management — rotation policies, single-use vs. reusable keys, storage safety
- Client ID & Client Secret — how apps identify themselves to APIs (not users, apps)
- Token introspection — how the server validates your token is genuine and not expired
- Error responses —
401 Unauthorized(not authenticated) vs.403 Forbidden(not permitted) - Refresh token flow — obtaining a new access token without forcing a full re-login
- Security best practices — tokens belong in headers, never URLs; transmitted only over HTTPS
- Test scenarios — valid token, expired token, wrong token, missing token; all must behave correctly
- OAuth 2.0 overview — a protocol that lets App A act on your behalf without knowing your password for App B
- 5 grant types — Authorization Code, Implicit, Password, Client Credentials, Device Code; when to use each
- Authorization Code Grant — the 3-legged flow used by websites serving real users (most secure)
- Client credentials —
client_id+client_secretidentify the app, not the user - Scopes — requesting minimal permissions: "read profile" vs. "full account access"
- Consent screen — the "Allow this app to…" dialog where users grant permission
- Authorization endpoint — where the user logs in and consents; returns an authorization
code - Token endpoint — server-side code exchange; returns
access_tokenandrefresh_token - Redirect URI validation — prevents attackers from intercepting the authorization code
- State parameter — random value preventing CSRF attacks during the OAuth flow
- JWT structure — three Base64URL-encoded parts:
Header(algorithm),Payload(claims),Signature - Base64URL encoding — the text scrambling that makes the token URL-safe (not encryption!)
- Standard claims —
iss(issuer),sub(subject),aud(audience),exp(expiry),iat(issued at) - Custom claims — app-specific data like user role, permissions, or account ID embedded in the token
- Signature algorithms —
HS256uses a shared secret;RS256uses a private/public key pair - Signature verification — how the server confirms the token is genuine and unchanged
- Expiry validation — always check
exp; test with past-expiry tokens to ensure they're rejected - Refresh token pattern — exchanging a long-lived refresh token for a fresh short-lived JWT
- Secure token storage — HTTPOnly cookies protect against XSS; localStorage does not
- JWT vulnerabilities to test —
alg:noneattack, algorithm confusion, signature stripping
multipart/form-data— the special request format that carries files alongside text fields- Boundary handling — the unique delimiter separating each part in a multipart request
- Single and multiple file uploads — testing both, including resumable large file uploads
Content-Typeheader — declaring file type to the server; test with mismatched typesContent-Disposition— carries the filename and form-field name in the upload- Binary data — images/PDFs require different handling than plain text; ensure encoding is correct
- File size validation — test files exactly at the limit, over the limit, and extremely large
- File type validation — test accepted extensions, rejected extensions, and spoofed MIME types
- Security tests — path traversal (
../../etc/passwd), XXE in XML uploads, malicious script files - Error handling — dropped uploads, quota exceeded, partial uploads; server must clean up gracefully
- Postman organization — workbench, collections (folders of requests), environments for switching targets
- Environment variables — define base URL and auth token once, switch from localhost to production in one click
- Pre-request scripts — JavaScript that runs before the request fires; perfect for fetching a fresh auth token
- Post-response test scripts — assertions: "verify status is 200 and name equals John"
- Dynamic variables —
{{$timestamp}},{{$guid}},{{$randomEmail}}for unique test data - Request chaining — capture the
idfrom Step 1's response and use it automatically in Step 2's URL - Collection Runner — execute all requests in a folder sequentially; like running a test suite
- Newman CLI — run
newman run collection.jsonfrom terminal; enables CI/CD pipeline integration - Data-driven testing — run the same request with a CSV of 100 different inputs for comprehensive coverage
- Team workspaces — share collections, environments, and scripts so the whole team tests consistently
- RestAssured setup — adding the dependency to
pom.xml(Maven) orbuild.gradle - The BDD syntax —
given()sets up the request,when()sends it,then()asserts the response - Request specification — create a reusable template with base URL and auth applied to all tests
- Dynamic URL parameters —
pathParam("id", userId)andqueryParam("page", 2) - Request body — attach JSON/XML using
.body(), maps, or serialized POJOs - Response extraction —
.extract().path("user.name")pulls specific values from the response - Hamcrest matchers —
equalTo(),containsString(),hasSize(),hasItem()in plain English - JSON Path assertions —
body("users[0].email", equalTo("test@test.com"))for nested data - Auth integration —
.auth().oauth2(token)and.auth().basic(user, pass)built in - TestNG / JUnit integration — annotate tests with
@Testfor full suite execution
- Standard request headers —
Accept,Content-Type,Authorization,User-Agent - Standard response headers —
Content-Type,Cache-Control,Set-Cookieand what to assert - Custom headers —
X-Request-Id,X-Correlation-Idand other app-specific headers - Content negotiation — client sends
Accept: application/json; server replies accordingly - Character encoding —
charset=UTF-8prevents garbled text in international content - CORS headers —
Access-Control-Allow-Origincontrols which domains can call the API - Cache control —
max-age,ETag,no-cachedirectives; test that caching works correctly - Compression —
gzip/deflateencoding; test that compressed responses decompress correctly - Response header assertions — verify specific headers are present and have the correct values
- JSON Schema validation — verify the entire response structure matches the contract, not just one field
- Database connection — connecting your test code to the DB using JDBC to run queries directly
- SQL query execution — after calling
POST /users, runSELECT * FROM users WHERE id=?to confirm - Test data setup and teardown — insert data before the test, delete it after; keep tests isolated
- Transaction rollback — wrapping tests in a transaction and rolling back so no data persists
- SQL injection testing — send
' OR '1'='1as input and verify the API rejects or escapes it - JSON-to-DB mapping — verify that a nested JSON object was correctly flattened into DB columns
- Multi-step E2E flow — Create → Update → Delete, verify DB state after each step
- Transaction boundary tests — deliberately fail mid-operation, verify DB is left in a clean state
- Connection pooling — close connections properly so tests don't exhaust the pool
- The gold-standard pattern — API call → assert response → SQL query → assert DB matches → done
- Status code meanings —
200OK,201Created,400Bad Request,401/403,404,409Conflict,500 - Error response structure — a good API returns a clear message explaining exactly what went wrong
- Field-level validation errors — "email is required" not just "bad request"; test that errors are specific
- Stack trace leaks — test in staging that error responses don't expose internal code to attackers
- Timeout scenarios — what happens if the server takes 30 seconds to respond? Does the client wait or give up?
- Network failure — test with a disconnected server; the client should handle the error gracefully
- Retry with exponential backoff — on a temporary failure, wait 1s, then 2s, then 4s before retrying
- Circuit breaker pattern — after 5 failures, stop trying for 60 seconds; prevents thundering herd
- Rate limiting — deliberately exceed the limit and verify
429withRetry-Afterheader - Graceful degradation — test that when one feature fails, the rest of the app still works
- Git fundamentals —
git init,add,commit,push,pull; the core daily workflow - Repository setup — creating a repo, choosing public vs. private, managing access
- Branching — work on a feature branch so your changes don't break
mainfor the team - Commit discipline — "Add JWT expiry test" tells future teammates what changed and why
- Pull requests — propose your changes, get feedback from teammates before merging
- Merge conflict resolution — when two people edited the same file, reconcile differences manually
.gitignore— the critical file that prevents.env, API keys, and passwords from being uploaded- Team roles — repo Owner, Collaborator, and Reviewer permissions; who can approve merges
- GitHub Issues — track test coverage gaps, bugs found, and automation tasks
- Project structure — organize folders so teammates can find tests, configs, and data files easily
- CI/CD concepts — Continuous Integration runs tests automatically; CD ships code to users
- Jenkins overview — an open-source automation server that orchestrates build, test, and deploy
- Jenkins jobs — Freestyle (click-based) vs. Pipeline (code-based with
Jenkinsfile) - GitHub webhook — GitHub notifies Jenkins the moment anyone pushes code; builds start in seconds
- Build triggers — push-based (instant) vs. poll-based (check every 5 minutes with cron syntax)
- Running API tests in Jenkins — the same tests you run locally, executed on a Jenkins agent server
- Test reporting — Jenkins parses JUnit/TestNG XML and shows a pass/fail trend across builds
- Artifact archiving — store the test report HTML so you can review it even after the build is gone
- Environment variables — Jenkins injects
TEST_URL,API_KEYas secrets so they're never in code - Manual approval gates — pause the pipeline and wait for a human sign-off before deploying
OAuth 2.0 Grant Types
Know all 5 grant types cold. "What's the difference between Authorization Code and Client Credentials?" — Authorization Code is for user-facing apps; Client Credentials is machine-to-machine. Mentioning PKCE for public clients shows senior knowledge.
JWT Decoding
Be ready to decode a JWT on a whiteboard. Three dot-separated parts, Base64URL-encoded. Signature uses HS256 (shared secret) or RS256 (asymmetric). Know the alg:none vulnerability — it's the most common JWT interview question.
RestAssured BDD Syntax
Write given().header("Authorization","Bearer "+token).when().get("/users/1").then().statusCode(200).body("name", equalTo("John")) from memory. Interviewers look for fluent API and Hamcrest knowledge.
CI/CD Pipeline Design
Describe a Jenkins pipeline: Checkout → Build → API Tests → Report → Deploy. Know declarative vs. scripted Jenkinsfile. Mention parallel stages for faster runs and webhook-based triggers.
E2E Testing Pattern
Describe: call POST /users, capture id from response, query DB with SELECT * FROM users WHERE id=?, assert both match. This dual-layer validation demonstrates mature testing thinking most candidates skip.
Security Testing
Cover: missing token (401), wrong scope (403), expired JWT, SQL injection in params, path traversal in file uploads (../../etc/passwd), IDOR by swapping IDs. Each is a distinct test category worth mentioning.