How to perform loop testing for test suite? #2610
Answered
by
jan-molak
UrvashiBhatt-eaton
asked this question in
How to... ?
-
I have Sereniry JS with Playwright configurations, Need Guidance here, Thanks in advanced. |
Beta Was this translation helpful? Give feedback.
Answered by
jan-molak
Nov 16, 2024
Replies: 1 comment
-
Hey @UrvashiBhatt-eaton - could you please clarify what exactly you'd like to loop over and at what level you want to parameterise it? For example, you could generate the // spec/website.spec.ts
import { describe, it } from '@serenity-js/playwright-test'
import { Send, GetRequest } from '@serenity-js/rest'
import { Ensure, equals } from '@serenity-js/assertions'
describe('Website', () => {
const paths = [
'/home.html',
'/contact.html',
'/services.html',
]
for (const path of paths) {
it(`loads ${ path }`, async ({ actor }) => {
await actor.attemptsTo(
Send.a(GetRequest.to(path)),
Ensure.that(LastResponse.status(), equals(200)),
)
})
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jan-molak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @UrvashiBhatt-eaton - could you please clarify what exactly you'd like to loop over and at what level you want to parameterise it?
For example, you could generate the
it
block dynamically like this: