How to run your Playwright test in parallel or in serial mode

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024
  • Learn how to run Playwright tests and spec files sequentially or in parallel by creating different directories and test configurations.
    Find more info in the Playwright docs: playwright.dev...
    #playwright

Комментарии • 30

  • @conorh999
    @conorh999 Год назад +1

    This is great, I've been an hour trying to do this in the test case code and a config change is all I needed.

    • @stefanjudis
      @stefanjudis Год назад +1

      Yay! Happy it's been useful! 🎉

  • @fonziVazquez
    @fonziVazquez Год назад +1

    Great tips! Thank you!

    • @stefanjudis
      @stefanjudis Год назад

      Thanks! Happy they're useful!

  • @Leader977
    @Leader977 8 месяцев назад +1

    That was helpful. Thank you :)

    • @ChecklyHQ
      @ChecklyHQ  8 месяцев назад

      Yay! Happy to hear that!

  • @The4m3r
    @The4m3r Год назад

    Great as always !!!

  • @Sowjanyanakkina
    @Sowjanyanakkina 3 месяца назад

    Hi Mate, have a question on the combo of serial mode + retry failed test method.
    Scenario Description :
    A home policy /quote creation involves multiple pages, each page depends on the successful completion of the previous page. Data is filled on each page and the process continues until the last page. After reaching the last page the policy gets created.
    The automation approach that I need:
    1. Treat each page as an individual test
    2. Test execution depends on the pass Status of the previous test.
    3. If any test fails subsequently should be skipped.
    4. Playwright should retry only the failed test for the retry count I provide, shouldn't attempt retrying any previously passed test(s).
    5. If the previously failed test passes during retrial executes subsequent tests.
    Please help, I have tried several combinations & approaches but no success yet! Thanks in advance.

    • @ChecklyHQ
      @ChecklyHQ  2 месяца назад

      Doing this with different tests seems a bit complicated and hard to realize with the test runner. I'd restructure things and use `test.step` for all your... well... steps (it sounds like it's different steps of one test). Then you have full control over what should be retried, failed and when. Hope this helps. 🦝

  • @ChiragMatkar
    @ChiragMatkar Год назад +1

    we have defined config parallel as true and each spec is defined as serial. we observed that all other tests are skipped if one fails . any way to change this behaviour ?

  • @gambit3904
    @gambit3904 Год назад

    Thanks for the video! How could I run many copies of a single test in parallel?

  • @satishpolisetty4217
    @satishpolisetty4217 5 месяцев назад

    Your videos really helped me in better understanding of playwright.I have one challenge in my current setup.I want the spec file execution in a particular order.Let's say I have atest.spec.ts and mtest.spec.ts.In this case I want mtest.spec.ts cases to be executed first(in parallel to save time) and after that atest.spec.ts should be picked up.And on top of all, another test say admincreation.spec.ts should be executed before all if I have ever configure to true from env file.
    Can you help me adressing this issue?
    Thanks in advcance.

    • @ChecklyHQ
      @ChecklyHQ  5 месяцев назад

      Would project dependencies to the trick for you? You can define the order of "test groups" with them. 👉 playwright.dev/docs/test-projects#dependencies

  • @yanjingtui
    @yanjingtui Год назад

    Nice video, but i want to know how can i define 2 workers run parallel, which 1 worker for tests in folder "a", and 1 worker for folder "b". a and b folder is like folder sequence in your video.

  • @saurabhsrivastav902
    @saurabhsrivastav902 10 месяцев назад

    Hi, I am using Jave with playwright and testng file to run with below command which runs test cases suite in sequence. Should I make changes in command too? >mvn test -Dbase.env=uat -Dbrowser.name=chrome -Dcountry.name=IN -Dtestng.name=testng_RegressionSuite.xml

    • @ChecklyHQ
      @ChecklyHQ  9 месяцев назад

      Hey, unfortunately we're not familiar with this setup and can't help with this question. :/

  • @SofiaGoyal
    @SofiaGoyal Год назад

    I have a question, how can we run playwright tests for the a/b testing senario?

    • @ChecklyHQ
      @ChecklyHQ  Год назад +1

      If you could give more info on the A/B test and what you want to test with PWT, we're happy to share some thoughts. :)

  • @AfsarBaig-wn6ml
    @AfsarBaig-wn6ml 4 месяца назад

    There is barely any example where I want to run tests in serial which are not dependent on each other but when one test fails other subsequent tests to pass.

    • @ChecklyHQ
      @ChecklyHQ  4 месяца назад

      I wouldn't say barely. One example coming to mind immediately is an ecom app where tests rely on an existing account to buy with different payment methods. These have to run in sequence bc otherwise one test is messing with the others. :)

  • @user-iw4su2jr4y
    @user-iw4su2jr4y 8 месяцев назад

    Hi,
    The website's custom web workers are failing when fully parallel is enabled in the playwright project as we are making the API calls using the web workers.
    Any solution to this scenario?

    • @ChecklyHQ
      @ChecklyHQ  8 месяцев назад

      Heyooo. :) It's very hard to give advice without looking at implementation details. Did you solve the problem already?

  • @meg6pat
    @meg6pat Год назад

    Great video, but I still got problem running tests. So I got 2 files:
    login.setup.ts which work in Chromium - login and creates storageState. And
    logout.spec.ts which is running on all browsers and it fails,
    as I see it, they didn't using storageState, but in config file they have “use {storageState: ./state.json}”.
    Any suggestions?

    • @ChecklyHQ
      @ChecklyHQ  Год назад

      That's hard to tell without looking at the actual code. But if you want, you can always join the Checkly community and ask there. checklyhq.com/slack

  • @salikhanan
    @salikhanan Год назад +1

    Quick Question
    in you example you have Two folder Parallel and Sequence
    How to Run one test from Parallel and one Test from sequence so that You can use a random value generated in parallel test can use in Sequence test

    • @ChecklyHQ
      @ChecklyHQ  Год назад

      For this I'd rather recommend using a fixture or a setup step. :) ruclips.net/video/2O7dyz6XO2s/видео.html

  • @shanthi3152
    @shanthi3152 Год назад

    How many workers max we can assign to execute tests ?

    • @stefanjudis
      @stefanjudis Год назад

      That's a great question: I don't think there's a limit from Playwright itself but usually you should set it depending on the number of CPUs that are available on the machine. When spinning up more workers than CPUs things aren't going in parallel anymore because one CPU has to handle multiple workers.