Skip to content

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 @Test that opens google.com passes.

Phase 1 โ€” REST Assured (HIGHEST PRIORITY โ€” it's the role) ~3 hrs

  1. Restful-Booker CRUD chain (the money exercise):
  2. POST /auth โ†’ extract token.
  3. POST /booking โ†’ create, capture bookingid.
  4. GET /booking/{id} โ†’ validate body fields + status 200.
  5. PUT /booking/{id} โ†’ full update (send token in Cookie/header).
  6. PATCH /booking/{id} โ†’ partial update.
  7. DELETE /booking/{id} โ†’ expect 201/204; then GET โ†’ expect 404.
  8. Add validations: status code, body fields, response time, headers.
  9. JSON schema validation against booking-schema.json.
  10. ReqRes: GET list with pagination, query params, assert 200; POST user โ†’ 201; GET unknown โ†’ 404.
  11. Serialization: build request body from a POJO (Booking.java), not raw strings.
  12. โœ… Checkpoint: you can write given().when().then() from memory and explain token chaining.
  13. Trains: Q8โ€“Q16, Q11 (schema), Q9 (extract), Q12โ€“Q15 (auth/JWT/Bearer).

Phase 2 โ€” Selenium core ~3 hrs

  1. SauceDemo login with POM (LoginPage โ†’ ProductsPage). Add data-driven login via TestNG @DataProvider (valid, locked-out, wrong password).
  2. DemoQA form โ€” fill text, radio, checkbox, dropdown, date, file upload, submit, assert confirmation.
  3. The Internet: broken-links finder (collect <a>, HTTP-check each), alerts, frames, multiple windows.
  4. Add all 3 waits (implicit, explicit, fluent) somewhere real.
  5. โœ… Checkpoint: you can write XPath/CSS on the spot and handle window/frame/alert.
  6. 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 /dropdown
Dropdown โ€” 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_loading
Alerts / pop-ups (accept, dismiss, getText, sendKeys) The Internet /javascript_alerts
Frames / iframes (frame, parentFrame, defaultContent) The Internet /iframe
Multiple windows / tabs (getWindowHandles, switch) The Internet /windows
Broken links (collect <a>, HTTP-check each) any page
Checkboxes & radio buttons DemoQA form
File upload (sendKeys path) The Internet /upload, DemoQA
Drag & drop / Actions class (mouse hover, right-click, double-click) The Internet /drag_and_drop
Web 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

  1. ITestListener โ†’ screenshot only on failure (Q41).
  2. IRetryAnalyzer โ†’ auto-retry failed tests; run testng-failed.xml (Q42).
  3. testng.xml with groups (smoke, regression) + parallel execution.
  4. config.properties reader; ExtentReports.
  5. Trains: Q30 (framework architecture), Q41โ€“Q42, Q73f (reports), Q73lโ€“Q73o (TestNG/Maven).

Phase 4 โ€” Optional if time (BDD + E2E) ~2 hrs

  1. Cucumber feature: wrap the SauceDemo login as Given-When-Then + a Scenario Outline with an Examples table (Q43โ€“Q47).
  2. 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

  1. JDK installed? which version (java -version)?
  2. Maven installed (mvn -version)? (or should we use Gradle?)
  3. Chrome browser present? (WebDriverManager handles the driver)
  4. IDE โ€” IntelliJ IDEA or Eclipse/VS Code?
  5. 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.

Sources (practice-site research)