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

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 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.

  • @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. :)

  • @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. :)

  • @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. :/

  • @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

  • @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?

  • @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. :) th-cam.com/video/2O7dyz6XO2s/w-d-xo.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.