Skip to content

Instantly share code, notes, and snippets.

@nadvolod
Last active May 21, 2025 19:07
Show Gist options
  • Save nadvolod/9b2bfda11877af6257436f834d03ca4b to your computer and use it in GitHub Desktop.
Save nadvolod/9b2bfda11877af6257436f834d03ca4b to your computer and use it in GitHub Desktop.
Data driven testing w/ pw
// ❌ 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