Verify API mocking enables parallel development
Preconditions (3)
✅ Expected Result: The mock server returns the example response correctly, allowing frontend and backend developers to work in parallel without blocking each other
Jump into concepts and practice - no test required
pm.test('Status code is 200', () => { pm.response.to.have.status(200); }); pm.test('Response matches mock example', () => { const expectedResponse = { "id": 1, "name": "Mocked User", "email": "mockuser@example.com" }; const jsonData = pm.response.json(); pm.expect(jsonData).to.eql(expectedResponse); }); pm.test('Request URL is mock server URL', () => { const mockUrl = pm.environment.get('mock_server_url'); pm.expect(pm.request.url.toString()).to.include(mockUrl); });
The first test checks that the response status code is 200, confirming the mock server responded successfully.
The second test compares the response body to the expected mock example, ensuring the mock returns the correct data.
The third test verifies that the request was sent to the mock server URL, confirming the frontend is using the mock endpoint.
Using environment variables for the mock server URL allows easy switching between mock and real servers.
This setup enables frontend developers to work with the mock API while backend developers build the real API, supporting parallel development.
Now add data-driven testing with 3 different mock user profiles