Reading about REST Assured and writing REST Assured are two different things. These exercises go from setup to framework-level code. Do them in order. By exercise 6, you will have a mini automation framework.
Create a new Maven project in IntelliJ (or your IDE)
Add rest-assured, testng, hamcrest, and jackson-databind to pom.xml
Create a test class called SmokeTest.java under src/test/java
Set baseURI to https://jsonplaceholder.typicode.com in @BeforeClass
Write one GET test: call /posts/1, assert status 200, assert id equals 1
Run the test. See green. Celebrate.
Write a test class GetRequestsTest.java with these 5 tests:
Write a test class CRUDTest.java. Use JSONPlaceholder API:
Write a test class MatcherPracticeTest.java. Use GET /posts and GET /users:
Refactor your tests to use RequestSpecBuilder and ResponseSpecBuilder:
Bring it all together. Create a proper project structure:
src/test/java/com/yourcompany/
├── base/
│ └── BaseTest.java ← Specs, baseURI, logging
├── pojo/
│ ├── Post.java ← Post POJO
│ └── User.java ← User POJO (id, name, username, email)
├── tests/
│ ├── PostsTest.java ← GET/POST/PUT/PATCH/DELETE for /posts
│ ├── UsersTest.java ← GET tests for /users
│ └── CommentsTest.java ← GET tests for /comments
└── testng.xml ← Suite file to run all testsAfter completing all 6 exercises, you have done everything a QA engineer does with REST Assured in a real project. Setup, GET, POST, CRUD, matchers, specs, and framework structure. Practice until writing given().when().then() is muscle memory.
Key Point: Do all 6 exercises in order: setup, GET variations, CRUD operations, Hamcrest matchers, specs refactoring, mini framework. This covers the real-world REST Assured workflow end to end.