Overview
This example shows how to test a REST API using SemanticTest. We’ll test the JSONPlaceholder API, which provides fake online REST API for testing.Complete Test
test.json
Running the Test
Breaking It Down
Test 1: Get User
1
Make HTTP Request
Fetch user with ID 1 from the API
2
Parse JSON Response
Convert JSON string to object
3
Validate Email Format
Check that email matches expected pattern
4
Assert Results
Verify all expectations are met
Test 2: Create Post
This test demonstrates POST requests with JSON body:JSONPlaceholder is a fake API, so it won’t actually create the post. But it simulates the response correctly!