Rayrun
← Back to Discord Forum

Run a single test multiple times in parallel #help

nagarjunaskposted in #help-playwright
Open in Discord

Do we have anyways to run the same tests multiple times in parallel ? Node and TS binding

We are trying to perform load test on MS Dynamics CRM including client side performance.

And We have only NeoLoad version 8 which don't have real browser protocol.

Traces are really helpful in this case and looking to see if I can trigger same test again parallelly with some options.

Something similar to invocation count in testng

Thanks <#1054804523652231198>

This thread is trying to answer question "The thread does not contain any question to answer."

9 replies

If it’s a one time test, copy paste and edit the file names could be an easy work around

Also forgot about this - https://github.com/scalewright/scalewright#readme

I haven't had time to try it out yet but plan to

@nagarjunask for load testing with Playwright specifically check this out: https://www.artillery.io/docs/reference/engines/playwright

@butchmayhew: Thank You. I will take a look.

Thank You. I will take a look.

@butchmayhew: Does not work on version 1.38.1 of PW

Does not work on version 1.38.1 of PW

Not sure if i understand you correctly. But should be possible with: fullyParallel: true and npx playwright test --repeat-each=10 etc

@gram7059 Exactly the same. I have not tried with --repeat-each attribute. Do you have any samples?

@nagarjunask: npx playwright test your.spec.ts --repeat-each=10

npx playwright test your.spec.ts --repeat-each=10

Thanks @gram7059 @.gleedo and @??? .

This solution solves my issues and works well. (tested)

It was very well mentioned in playwright documentation but my bad I missed it.

Thanks Again!

Answer

Sure, you can run the same tests multiple times in parallel with Playwright. Here's how:

Single Worker

You can set workers: 1 in the config file or use --workers=1 in the command line. This runs tests sequentially, with only one worker active at a time.

// playwright.config.ts
module.exports = {
  workers: 1
};

Parallel Tests

For independent tests in a single file, use test.describe.configure(). Set mode: 'parallel' to run all tests in the suite in separate worker processes.

test.describe.configure({ mode: 'parallel' })('my suite', () => {
  // Your tests here
});

Fully-Parallel Mode

In playwright.config.ts, set fullyParallel: true for all test files or specific projects. Be mindful of inter-dependent tests that need to run serially. Annotate these as "serial". If a serial test fails, all subsequent tests are skipped.

// playwright.config.ts
module.exports = {
  projects: [
    {
      name: 'Project 1',
      fullyParallel: true
    },
    {
      name: 'Project 2',
      fullyParallel: false
    }
  ]
};

Control Test Execution Order

When not using parallelism, Playwright runs test files alphabetically. You can control the order by prefixing filenames with numbers. Alternatively, define tests in helper functions across multiple files. Call these functions in a specific order to control execution. However, this method is discouraged and supported as a best-effort only.

For more details, check out Maximizing Test Efficiency with Parallelism in Playwright.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.