← Back to Discord Forum

How to manage tests by Configuration File ?

I have a lot of test files. I want managing them using a config file something on principle:

test_scenario1.py true test_scenario2.py false test_scenario3.py true

How to write a configuration file and how to run the test set to true ?

This thread is trying to answer question "How can I manage multiple test files using a configuration file and how can I run the tests set to true?"

0 replies


Managing Multiple Test Files with Playwright

With Playwright, you can manage multiple test files using the projects option in the configuration file. This allows you to define different projects with their own properties and settings.

Here's how you can do it:

Define Projects in Configuration File

In your playwright.config.ts file, define each project within the projects array. Each project is an object with properties like name, testMatch, testIgnore, and retries.

import { defineConfig } from '@playwright/test';

export default defineConfig({
  timeout: 60000,
  projects: [
      name: 'Smoke',
      testMatch: /.*smoke.spec.ts/,
      retries: 0,
      name: 'Default',
      testIgnore: /.*smoke.spec.ts/,
      retries: 2,

In this example, the "Smoke" project includes all test files matching /.*smoke.spec.ts/ with no retries. The "Default" project includes all other test files with a retry count of 2.

Run the Tests

To run the tests, use the --project flag followed by the project name.

npx playwright test --project=Smoke
npx playwright test --project=Default

This will run only the tests associated with the specified project.

By using projects in your configuration file and the --project flag, you can effectively manage and run multiple test files with different configurations.

Related Discord Threads

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.