filmov
tv
Playwright API Testing Demo for Beginners

Показать описание
Project Setup
Create a API Test Step-by-Step
How to run a GET API Request
How to run a POST API Request
How to run a PUT API Request
How to run a DELETE API Request
How to validate API Response
Check response, logs, errors in UI Mode
Check HTML Report
*API Testing with Playwright - Project Setup*
Step 1 - Create a new folder for API Testing Project
Step 2 - Open the folder in VS Code
Step 4 - Check if demo tests are running fine using commands npx playwright test
npx playwright test --ui
npx playwright show-report
*How to run a GET API Request *
Step 1 - Add imports
Step 2 - Create a test using request context
Step 3 - Send a GET request & store response in a variable
Step 4 - Verify the status code of the response is 200
Step 5 - Check response contains some text
expect(text).toContain('Janet');
Step 6 - Write response on the console
Step 7 - Run and check results
*How to run a POST API Request*
Step 1 - Add imports
Step 2 - Create a test using request context
Step 3 - Send a POST request along with request body & store response in a variable
data: {
"name": "Raghav",
"job": "teacher"
}
})
Step 4 - Verify response status code is 201
Step 5 - Check response contains some text
expect(text).toContain(Raghav);
Step 6 - Write response on the console
Step 7 - Run and check results
*How to run a PUT API Request*
test('Demo API PUT Request', async ({ request }) => {
data: {
"name": "Raghav",
"job": "teacher"
}
})
expect(text).toContain('Raghav');
})
*How to run a DELETE API Request*
test('Demo API DELETE Request', async ({ request }) => {
})
References
▬▬▬▬▬▬▬
Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
▬▬▬▬ USEFUL LINKS ▬▬▬▬
—
Create a API Test Step-by-Step
How to run a GET API Request
How to run a POST API Request
How to run a PUT API Request
How to run a DELETE API Request
How to validate API Response
Check response, logs, errors in UI Mode
Check HTML Report
*API Testing with Playwright - Project Setup*
Step 1 - Create a new folder for API Testing Project
Step 2 - Open the folder in VS Code
Step 4 - Check if demo tests are running fine using commands npx playwright test
npx playwright test --ui
npx playwright show-report
*How to run a GET API Request *
Step 1 - Add imports
Step 2 - Create a test using request context
Step 3 - Send a GET request & store response in a variable
Step 4 - Verify the status code of the response is 200
Step 5 - Check response contains some text
expect(text).toContain('Janet');
Step 6 - Write response on the console
Step 7 - Run and check results
*How to run a POST API Request*
Step 1 - Add imports
Step 2 - Create a test using request context
Step 3 - Send a POST request along with request body & store response in a variable
data: {
"name": "Raghav",
"job": "teacher"
}
})
Step 4 - Verify response status code is 201
Step 5 - Check response contains some text
expect(text).toContain(Raghav);
Step 6 - Write response on the console
Step 7 - Run and check results
*How to run a PUT API Request*
test('Demo API PUT Request', async ({ request }) => {
data: {
"name": "Raghav",
"job": "teacher"
}
})
expect(text).toContain('Raghav');
})
*How to run a DELETE API Request*
test('Demo API DELETE Request', async ({ request }) => {
})
References
▬▬▬▬▬▬▬
Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
▬▬▬▬ USEFUL LINKS ▬▬▬▬
—
Комментарии