Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 2.5 KB

aboutExamples.md

File metadata and controls

38 lines (28 loc) · 2.5 KB

About the examples

All example tests run against the Platzi Fake Store API — https://api.escuelajs.co/docs#.

APIs used

Purpose Method Endpoint
Create user POST /api/v1/users
Get / update / delete user GET / PUT / DELETE /api/v1/users/{id}
Check email availability POST /api/v1/users/is-available
Login POST /api/v1/auth/login
Get profile (auth) GET /api/v1/auth/profile

4 styles to write a test

You can write the same test in any of these four styles — pick the one that fits how much setup you want to do. Click a guide to learn how to set it up.

1. Zero setup

No code behind the scenes. You don't write any Java — just start writing your Cucumber scenarios using the predefined generic step definitions (raw base URL, raw paths, free-form JSON bodies). Similar in concept to the Karate DSL, but built in-house on Cucumber + REST Assured. Easiest to start with, but not recommended for big projects — the raw strings are spread across every feature and get hard to maintain. → zeroSetupGuide.md

2. Constants setup

Still uses the generic step definitions, but instead of raw strings you register your base URL, endpoints and payloads once as enums and reference them by name in the feature. Needs a bit of setup, but it saves you time when a URL, endpoint or payload changes — you update it in one place instead of every scenario. → constantsSetupGuide.md

3. Custom script

No Cucumber at all — plain TestNG tests written in Java. You build your own API client classes, POJO classes, object-mother classes, and even flow classes for complex, multi-step scenarios. Best for complex projects — offers great flexibility and maintainability when you prefer code over Gherkin. → customScripSetupGuide.md

4. Wrapper setup

Everything you build for Custom script (clients, POJOs, mothers, flows), then wrapped in Cucumber step definitions so scenarios read like plain English (e.g. When a new user is created). The most difficult to maintain style, you have to maintain all those custom step definitions. But it's great for big teams that want product owners, manual QAs and non-developers to help write test cases directly in the domain language. → wrapperSetupGuide.md