Last active
May 21, 2025 19:07
-
-
Save nadvolod/9b2bfda11877af6257436f834d03ca4b to your computer and use it in GitHub Desktop.
Data driven testing w/ pw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ❌ duplicate test name | |
for (const user of testUsers) { | |
test(`GET users`, async({request}) => { | |
const response = await request.get(`https://jsonplaceholder.typicode.com/posts/${user.id}`) | |
// assertions here | |
}) | |
} | |
// ✅ each test within a describe block has a unique name | |
for (const user of testUsers) { | |
test(`GET users/${user.id} for user ${user.name}`, async({request}) => { | |
const response = await request.get(`https://jsonplaceholder.typicode.com/posts/${user.id}`) | |
// assertions here | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment