Skip to content

API Testing Interview Questions for Playwright

3 API Testing questions with answers for playwright roles. Tick what you have solved to track your progress.

Sheet progressStart practicing
02

Write an API test with the request fixture.

Show answer
test('get user', async ({ request }) => { const res = await request.get('/api/users/1'); expect(res.ok()).toBeTruthy(); expect((await res.json()).id).toBe(1); });
03

How do you create test data through the API before a UI test?

Show answer
In a fixture or beforeEach, call the API (request.post) to create the user or order, use it in the UI test, then delete it in teardown. It is faster and more reliable than creating data through the UI.