Skip to content

How to perform loop testing for test suite? #2610

Discussion options

You must be logged in to vote

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:

// 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.s…

Replies: 1 comment

Comment options

You must be logged in to vote
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
Labels
@serenity-js/playwright @serenity-js/playwright-test Serenity/JS reporter and test APIs for Playwright Test
2 participants