Practice Project Plan โ Selenium + REST Assured (Interview Coding Prep)¶
Goal: Build one Maven project where you can practise the exact coding tasks Infosys (and similar) interviewers ask โ Selenium UI automation + REST Assured API automation โ using free, stable, well-known practice sites. This is the plan; we execute it after you approve.
Maps to: Infosys_API_Testing_JL5_Interview_Prep.md โ every exercise here trains a question from that file.
1) Which sites/APIs to use (and why these)¶
These are the industry-standard interview practice targets โ interviewers literally name them and they stay online/stable.
A. Selenium UI practice sites¶
| Site | URL | What it trains (interview topics) |
|---|---|---|
| SauceDemo (Swag Labs) โญ | https://www.saucedemo.com | Login, e-commerce flow, add-to-cart, checkout, sort dropdown โ POM, end-to-end, data-driven login |
| The Internet (Heroku) โญ | https://the-internet.herokuapp.com | Alerts, frames, windows, dynamic loading, broken links, file upload, drag-drop, tables โ the "edge case" questions |
| DemoQA / ToolsQA Practice Form โญ | https://demoqa.com/automation-practice-form | All web elements: text, radio, checkbox, dropdown, datepicker, file upload โ classic "automate a form" task |
| OrangeHRM demo | https://opensource-demo.orangehrmlive.com | Real login + HR dashboard โ login + waits + navigation |
| ParaBank (optional) | https://parabank.parasoft.com | Banking flow + has its own API/DB โ good for end-to-end UI+API+SQL story |
Priority for 2 days: SauceDemo + The Internet + DemoQA form. These cover ~90% of UI coding asks (login, form, broken links, alerts, frames, windows, waits, StaleElement).
B. REST Assured API practice (โญ this is the role โ focus here)¶
| API | Base URL | What it trains |
|---|---|---|
| Restful-Booker โญโญ | https://restful-booker.herokuapp.com | Full CRUD + token auth โ POST(create), GET, PUT, PATCH, DELETE, auth token. The single best API for interview practice. Resets every 10 min, comes with bugs to find. |
| ReqRes โญ | https://reqres.in/api | Simple CRUD + pagination, query params, status codes โ quick smoke tests |
| JSONPlaceholder | https://jsonplaceholder.typicode.com | Fake CRUD, nested JSON โ JSON path extraction practice |
| Swagger Petstore (optional) | https://petstore.swagger.io | Has a Swagger contract โ JSON schema validation practice |
Priority: Restful-Booker first (covers create token โ CRUD โ auth header โ chaining), then ReqRes for status codes/pagination.
2) Tech stack (matches the JD exactly)¶
- Java 17 (or your installed JDK 8/11+)
- Maven โ build + dependency management
- Selenium 4 โ UI automation
- REST Assured โ API automation
- TestNG โ test runner (annotations, data providers, parallel)
- Hamcrest / JSON Schema Validator โ assertions + schema validation
- WebDriverManager (Bonigarcia) โ auto driver setup (no manual chromedriver)
- ExtentReports (optional) โ reporting
- Cucumber (optional, Phase 4) โ to also tick the BDD box
3) Project structure (POM-style, what we'll create)¶
selenium-restassured-practice/
โโโ pom.xml # dependencies + surefire
โโโ testng.xml # suite control / grouping
โโโ src/
โ โโโ main/java/
โ โ โโโ base/BaseTest.java # driver setup/teardown
โ โ โโโ pages/ # Page Object Model
โ โ โ โโโ LoginPage.java
โ โ โ โโโ ProductsPage.java
โ โ โ โโโ CheckoutPage.java
โ โ โโโ utils/
โ โ โ โโโ ConfigReader.java # read config.properties
โ โ โ โโโ ExcelUtil.java # data-driven source
โ โ โ โโโ ScreenshotListener.java # ITestListener (fail-only screenshot)
โ โ โโโ api/
โ โ โโโ BaseApiTest.java # baseURI, specs
โ โ โโโ payloads/Booking.java # POJO for serialization
โ โโโ test/java/
โ โโโ ui/ # Selenium tests
โ โ โโโ LoginTest.java
โ โ โโโ FormTest.java
โ โ โโโ BrokenLinksTest.java
โ โ โโโ AlertsFramesWindowsTest.java
โ โ โโโ E2ECheckoutTest.java
โ โโโ api/ # REST Assured tests
โ โโโ RestfulBookerCrudTest.java
โ โโโ AuthTokenTest.java
โ โโโ ReqResTest.java
โ โโโ SchemaValidationTest.java
โโโ src/test/resources/
โโโ config.properties
โโโ testdata.xlsx / testdata.json
โโโ schemas/booking-schema.json
4) Execution plan โ phased (you have ~2 days; do Phase 1โ3 first)¶
Phase 0 โ Setup (30 min)¶
- Confirm JDK + Maven installed (
java -version,mvn -version). - Create Maven project, add all dependencies to
pom.xml. - Add WebDriverManager so Chrome "just works".
- โ
Checkpoint: one dummy
@Testthat opens google.com passes.
Phase 1 โ REST Assured (HIGHEST PRIORITY โ it's the role) ~3 hrs¶
- Restful-Booker CRUD chain (the money exercise):
POST /authโ extract token.POST /bookingโ create, capturebookingid.GET /booking/{id}โ validate body fields + status 200.PUT /booking/{id}โ full update (send token inCookie/header).PATCH /booking/{id}โ partial update.DELETE /booking/{id}โ expect 201/204; then GET โ expect 404.- Add validations: status code, body fields, response time, headers.
- JSON schema validation against
booking-schema.json. - ReqRes: GET list with pagination, query params, assert 200; POST user โ 201; GET unknown โ 404.
- Serialization: build request body from a POJO (Booking.java), not raw strings.
- โ
Checkpoint: you can write
given().when().then()from memory and explain token chaining. - Trains: Q8โQ16, Q11 (schema), Q9 (extract), Q12โQ15 (auth/JWT/Bearer).
Phase 2 โ Selenium core ~3 hrs¶
- SauceDemo login with POM (LoginPage โ ProductsPage). Add data-driven login via TestNG
@DataProvider(valid, locked-out, wrong password). - DemoQA form โ fill text, radio, checkbox, dropdown, date, file upload, submit, assert confirmation.
- The Internet: broken-links finder (collect
<a>, HTTP-check each), alerts, frames, multiple windows. - Add all 3 waits (implicit, explicit, fluent) somewhere real.
- โ Checkpoint: you can write XPath/CSS on the spot and handle window/frame/alert.
- Trains: Q30โQ42, Q73a (login coding).
โญ MUST-HAVE: comprehensive UI-task coverage (user requirement). The UI suite must include at least one working test for every common Selenium task below โ these are exactly what gets asked "write it now" in the interview:
UI task Where to practise it Dropdown โ static ( Select: byVisibleText/Index/Value)DemoQA / The Internet /dropdownDropdown โ dynamic/custom (click + pick from list) DemoQA "Select Menu" (React dropdowns) Screenshot on error/failure (fail-only, ITestListener)wired in Phase 3, used across all tests Locator identification โ all types (id, name, css, xpath absolute/relative, contains(), relative locators)SauceDemo + DemoQA Waits โ implicit / explicit / fluent (all three) The Internet /dynamic_loadingAlerts / pop-ups (accept, dismiss, getText, sendKeys) The Internet /javascript_alertsFrames / iframes (frame, parentFrame, defaultContent) The Internet /iframeMultiple windows / tabs (getWindowHandles, switch) The Internet /windowsBroken links (collect <a>, HTTP-check each)any page Checkboxes & radio buttons DemoQA form File upload (sendKeys path) The Internet /upload, DemoQADrag & drop / Actions class (mouse hover, right-click, double-click) The Internet /drag_and_dropWeb tables (read rows/cells, sort, validate data) DemoQA "Web Tables" Scrolling (JavascriptExecutor) + screenshot of element any long page Keyboard / mouse actions (Actions, Keys) DemoQA โ Tick each row off as we build it โ the goal is muscle memory for "write the code on the spot."
Phase 3 โ Framework polish (lead-level signals) ~2 hrs¶
- ITestListener โ screenshot only on failure (Q41).
- IRetryAnalyzer โ auto-retry failed tests; run
testng-failed.xml(Q42). testng.xmlwith groups (smoke,regression) + parallel execution.config.propertiesreader; ExtentReports.- Trains: Q30 (framework architecture), Q41โQ42, Q73f (reports), Q73lโQ73o (TestNG/Maven).
Phase 4 โ Optional if time (BDD + E2E) ~2 hrs¶
- Cucumber feature: wrap the SauceDemo login as Given-When-Then + a Scenario Outline with an Examples table (Q43โQ47).
- End-to-end story: ParaBank โ create account via UI, verify via API, (optionally) note where a SQL check would go (Q18, ties SQL story together).
5) Exercise โ interview-question map (quick reference)¶
| Exercise | Interview Q it answers |
|---|---|
| Restful-Booker auth + CRUD chain | "Write REST Assured code", "extract a token", POST vs PUT, status codes, auth |
| JSON schema validation | "How do you validate response structure?" (Q11) |
| ReqRes pagination/negative | status codes incl. 404/400, query params |
| SauceDemo POM + DataProvider | "Explain your framework", data-driven, "automate login" |
| Broken links finder | "Write code to find broken links" (Q40) |
| Alerts/frames/windows | window & frame handling snippets (Q33โQ34) |
| 3 waits | implicit/explicit/fluent syntax (Q32) |
| Fail-only screenshot listener | "screenshots only for failed tests" (Q41) |
| Retry + testng-failed.xml | "200 tests, 49 failed โ rerun only failed" (Q42) |
| Cucumber Scenario Outline | BDD, scenario outline (Q45) |
6) Prerequisites to confirm before we execute¶
- JDK installed? which version (
java -version)? - Maven installed (
mvn -version)? (or should we use Gradle?) - Chrome browser present? (WebDriverManager handles the driver)
- IDE โ IntelliJ IDEA or Eclipse/VS Code?
- Internet access to the practice sites from your machine.
If anything's missing, the first execution step is installing it.
7) Suggested order given only ~2 days¶
- Day 1 (today/tomorrow): Phase 0 + Phase 1 (REST Assured) fully + start Phase 2 Selenium login & form.
- Day 2: Finish Phase 2 (broken links, alerts, frames, windows, waits) + Phase 3 listener/retry. Skim Phase 4 only if comfortable.
- Interview morning: re-run the Restful-Booker CRUD test and the SauceDemo login once โ muscle memory.