Skip to content

[Feature] Add possibility to run only one test from several parameterized tests #19028

@viraxslot

Description

@viraxslot

Hi team. It's a proposal for Playwright Test Runner.

I really like parameterized tests, they allow to decrease amount of code:
https://playwright.dev/docs/test-parameterize#parameterized-tests

What I don't like in them: debugging.
Because I need:

  1. Set "only" for the test function.
  2. Comment a part of test data array (sometimes it can be really huge, so scroll up, scroll down).
  3. Run the test, debug, fix the problem.
  4. Uncomment test data and remove "only".

Feature request: it would be really nice to have something like test.first and test.last functions to easily debug parameterized tests.
test.first runs the first test only (takes the first element from test data array).
test.last runs the last only.

So it could look like:

const testData = [1, 2, 3, 4, 5];

// should pass
testData.forEach(data => {
  test.first('check array value 1', () => {
    expect(data).toBe(1);
  });
});

// should fail
testData.forEach(data => {
  test.last('check array value 2', () => {
    expect(data).toBe(1);
  });
});

I hope it's possible to implement and you'll like the idea :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions