PART 5 - Run Cucumber Feature Files in Parallel Mode using Maven Fail Safe Plugin & JUNIT

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • #CucumberBDD #CucumberParallelRun #NaveenAutomationLabs
    In this video, I have explained how to achieve parallel execution at the feature level using Maven FailSafe Plugin and Junit.
    We will also see how to get Cucumber Thread based report.
    We will be designing different components in this Framework:
    1. Feature Files
    2. Step Definition Classes
    3. Configuration Files
    4. Cucumber Hooks with before and after
    5. Element Utilities/Libraries/Generic Functions
    6. Cucumber 6 Extent Report Adaptor for Spark HTML / PDF Reports
    7. Test Runners in JUnit
    8. Page Classes for POM
    9. Maven with pom.xml with different dependencies and plugins
    10. Parallel Execution
    11. Cucumber 6 Web HTML Reports
    12. Screenshot for Failure scenarios
    13. Integration with GIT Repo
    14. Running test cases from Jenkins
    15. Running test cases on Dockerized Selenium GRID
    And much more.....
    Technologies Used:
    1. Selenium WebDriver with Java Language binding
    2. Cucumber 6.x JVM library
    3. WebDriverManager
    4. JDK 1.8
    5. Maven (Build tool)
    6. Maven Plugins
    7. Cucumber extent report 6 adapter
    8. JUnit 4.x library
    9. Log4j
    10. GIT HUB - Git Repo
    11. Docker
    12. Jenkins
    13. Eclipse (IDE)
    ~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    www.youtube.co...
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
    t.me/joinchat/...
    Paid courses (Recorded) videos:
    naveenautomati...
    For Java & Selenium - naveenautomatio...
    For API (Manual + Automation) - naveenautomatio...

КОМЕНТАРІ • 129

  • @bhuvanabaskaran8063
    @bhuvanabaskaran8063 3 роки тому +6

    Thank you so much Naveen...this series helps me a lot.... because of your videos and am confident enough to crack interviews

  • @shashibhushanv6301
    @shashibhushanv6301 3 роки тому +3

    Parallel execution is now made much easier. Looking forward to the cross-browser testing using Junit.
    I did with Maven sure-fire and fail-safe plugins and both look good.
    Thanks a ton, Naveen.

    • @sakthisaravana6663
      @sakthisaravana6663 3 роки тому +1

      Hi Shashibhusan, i tried with the above plugins but its running sequentially. Can you please share the plugins you have used. Thanks

  • @saikatdhar8689
    @saikatdhar8689 2 роки тому +2

    it's really a perfect illustration for understanding.

    • @saikatdhar8689
      @saikatdhar8689 2 роки тому

      Just wanted to know any plans ahead to start any batch / classes for TOSCA ?

  • @leonardo91681
    @leonardo91681 2 роки тому

    Thanks for this great series, Naveen! You are slowly, but surely converting another manual tester to an automation tester.
    I confronted a few issues getting the parallel execution to work using JUnit and here is how I managed to solve them:
    1. One of the problems I confronted was that my failsafe plugin would not execute the tests and instead the surefire plugin would execute them using a single thread. One suggestion from one of your viewers, thanks @Anyik Duku, was to remove the testNG dependency. After doing this my failsafe plugin started executing the tests.
    2. Here is when my second problem started. For some reason my surefire plugin was still executing the tests using a single thread and after finishing then the failsafe plugin kicked in and performed the tests again using two threads. The problem this time was that I had named my Runner file as "TestRunner.java" instead of "MyTestRunner.java" and the surefire plugin will execute any java filename that starts with the word Test by default. I solved this problem by excluding my runner file in my surefire plugin configuration.

    • @nityaranjan6714
      @nityaranjan6714 2 роки тому

      I have implemented the same but parallel execution is not happening. only one thread is opening at a time.

    • @patilnilesh9668
      @patilnilesh9668 2 роки тому

      @@nityaranjan6714 same for me

    • @Al-oh9yr
      @Al-oh9yr Рік тому

      @@nityaranjan6714 same for mee ro bro. Did you manage to resolve?

    • @sathiyamoorthip9739
      @sathiyamoorthip9739 Рік тому

      I have implemented the code but single thread is opening at a time.

    • @Al-oh9yr
      @Al-oh9yr Рік тому

      @@sathiyamoorthip9739 how and where can we get help on this bro?

  • @gayathrivr
    @gayathrivr 2 роки тому +1

    Tons of thanks. I sorted out parallel testing.

  • @SarangHoley
    @SarangHoley 3 роки тому +1

    As always thanks for video Naveen ☺️ n it's been really helpful that you had covered the limitation for parallel testing while working with Cucumber - JUnit 👍👍

  • @ankur5510
    @ankur5510 3 роки тому

    Much needed tutorial..kindly cover the execution on different environments..

  • @Vinodmhetre007
    @Vinodmhetre007 3 роки тому

    Thanks a ton for this Cucumber series. Many things to learn.

  • @shashwatkatiyar1377
    @shashwatkatiyar1377 3 роки тому +1

    Awesome ..Thanks for the video

  • @anandsinha6407
    @anandsinha6407 3 роки тому

    Thanks Naveen for great video waiting for next

  • @athiradu1154
    @athiradu1154 2 роки тому +1

    Everything was done in command prompt it says build sucessful ,but the browser is not opening... please someone help me

    • @AnirudhSharmaisme
      @AnirudhSharmaisme Рік тому

      Same issue my getting ...build successful but tests are not executing...did ur issue got fixed?

  • @akashsontake1440
    @akashsontake1440 23 дні тому

    thanks naveen

  • @supriyassampath1419
    @supriyassampath1419 3 роки тому

    Thank you so much Naveen.. 🙏🙏

  • @tulasiramsunkara
    @tulasiramsunkara 3 роки тому +1

    @Naveen- Appreciated your video on parallel execution... Couple of things observed.
    1. driver.quit is called without Null check.
    2. Need to implement Exception mechanisms
    These should be part of framework designs at the initial stages.

    • @socialmedia434
      @socialmedia434 3 роки тому

      Hi Tulsi ram, how to implement driver.quit with null check. Can u share the code here

    • @tulasiramsunkara
      @tulasiramsunkara 3 роки тому +1

      @@socialmedia434 if(driver!=null){ driver.quit();}

  • @busraozdemir2822
    @busraozdemir2822 3 роки тому +1

    It has been a great video series.Thank you

  • @subhuvijay41
    @subhuvijay41 3 роки тому

    Thanks Naveen.. it really helps! Can you please post a video for parallel testing - cucumber with testng. Looking forward your upcoming videos!!

  • @niazmaksud1139
    @niazmaksud1139 5 місяців тому

    @naveen Thanks for creating this series. I am getting error 'mvn command is not recognized as an internal or external command' while running test suite through command prompt. Could you please share any solution to fix this?

  • @shubhamparab5466
    @shubhamparab5466 3 роки тому

    Thanks Naveen this helped a lot

  • @ajitkumarsrivastava3577
    @ajitkumarsrivastava3577 2 роки тому

    Hye Naveen,
    I saw your video 5 and 6 regarding parallel execution and its awesome.
    Can you post video for cross browser testing in parallel mode of feature files.
    Thank you

  • @siteshvishwakarma7211
    @siteshvishwakarma7211 25 днів тому

    Hi Sir, Could you please make a video on mobile automation for parallel execution using Appium with cucumber? It will be beneficial.

  • @ramachandrabalam6354
    @ramachandrabalam6354 2 роки тому

    Hello Naveen,
    Thanks a ton for making our life easy with such nice videos.
    I couldn't find your GIT hub url to clone the project. Could you please provide it?

  • @sampadachendake6337
    @sampadachendake6337 Рік тому

    Hi Naveen, Awesome as always. Thanks for video. Is this available in GITHUB account of yours ?

  • @krsnarayana
    @krsnarayana 3 роки тому

    Hi Naveen,
    Awesome ..Thanks for the videos.
    Could you please make a video on cucumber Junit with Cross-browser testing

  • @bhupendrasharma7826
    @bhupendrasharma7826 2 роки тому

    hi @naveen I saw your video just today. Really helpful.
    One thing wanted to understand about the plugins used here.
    Can you please share the benefits of using these plugins as well.
    I tried searching but could not get much clarity in this context.

  • @abhilashraj7224
    @abhilashraj7224 2 роки тому

    Awesome explanation .
    #NaveenAutomationLabs @NaveenAutomationLabs
    I have doubt about how we create plugins in pom.xml.
    I know about dependency which we copy from mvnrepository pasteit under dependencies. But what about Plugins. I am creating a project then how can I required plugins.

  • @user-ef1og4lj2l
    @user-ef1og4lj2l 10 місяців тому

    This runs the feature files sequentially and not parallely. I have removed the testng dependencies . have tried using surefire and failsafe plugins together and individually . Have tried via IntelliJ console and cmd. Can you please help.

  • @rajasekharmaddigalla1463
    @rajasekharmaddigalla1463 3 роки тому

    Hi Naveen, Thanks a lot for your knowledge sharing, in cucumber 6 can you please advice how to execute feature files in sequence? I am implementing this framework in my real time project please do need fully

  • @prathibasankar1829
    @prathibasankar1829 10 місяців тому

    Hi Naveen, Did you write code for element util class ?

  • @swapnilbodade1336
    @swapnilbodade1336 3 роки тому +1

    Hi Naveen,
    How we can do parallel testing by scenario level, In my company we have single feature file in which we write all the scenarios

    • @shashibhushanv6301
      @shashibhushanv6301 3 роки тому +1

      @ In TestNG the scenarios and rows in a scenario outline are executed in multiple threads.... Not sure if this option is given using Junit...
      cucumber.io/docs/guides/parallel-execution/

  • @anshulkapoor9929
    @anshulkapoor9929 Рік тому

    I believe parallel execution at scenario level is resolved with Junit5.

  • @mpregos
    @mpregos 2 роки тому

    Hello Naveen, Great video. I have set up cucumber + junit + selenium and i enable parallel using maven-surefire-plugin. the problem is that i do not have real time console log. I run the command , mvn clean test and the test are running, but in console i do not see any logs.All the test bumped at once at the end of the test or if the test duration is big, then after some time ,Do you have any idea how could i have real time consoloe log in paralell mode?

  • @SingaporeChinnodu
    @SingaporeChinnodu 3 роки тому

    we have specified Parallel = methods maven fail safe plugin right. We can set it to classes also. But what ever we set it junit runs tests only at feature level right. Then what's the use to specify parallel tag explicitly?

  • @ashuiet
    @ashuiet 3 роки тому

    Hi Naveen,
    I am getting BROKEN_IMAGE snapshot in my extent report apart from that issue everything working as expected.
    however, for below scenario I am able to achieved.
    1. For Fail step-definition Screenshot created in respective directory.
    2. In cucumber report fail step-definition Screenshot was attached.

  • @vijaykaushal9311
    @vijaykaushal9311 3 роки тому

    Hello Naveen, First of all.. thanks a lot for sharing your knowledge. You are a genius.
    I have one small query. I noticed that on running test runner file from eclipse features are not executed in parallel whereas if we execute from the command prompt using maven verify command then features are executed in parallel. Just wanted to know that using these maven surefire and failsafe plugins is it not possible to achieve parallel execution when we run from IDE like an eclipse or Intellij?
    Also, it would be great if could you please make a video on how to pass test cases from Jira using the XRay plugin to feature file. I believe this will be beneficial for a lot of people like me who are learning automation.
    Thanks in Advance!!

    • @MadirajuKChaitanya
      @MadirajuKChaitanya 3 роки тому

      Hi @Naveen Sir and Vijay, I tried executing the Test Runner file from both Eclipse IDE and the Command Prompt. But in my case, in both these cases, my feature files are not executing in parallel. Can you please let me know...where the error could be...?. I wrote the scripts the same way as mentioned in the video. Thanks, in advance.

    • @vs8738
      @vs8738 3 роки тому

      Hi @Vijay Kaushal can u please advise as u were able to execute in parallel ... many are facing issue as it is not executing in parallel.

  • @vicky1577
    @vicky1577 3 роки тому +1

    Hi Naveen,
    I am following the same way. My build is a success but test cases are not even running. Could you please tell me what could have gone wrong?

    • @Nykster
      @Nykster 3 роки тому +1

      @Sravan Kumar Kolla remove testng dependencies then should work... I had the same issue but now ok

  • @anandsinha6407
    @anandsinha6407 3 роки тому

    One question so if we run directly from runner file it parallel execution can be achiveied once i make the changes as u shown in the video

  • @nandy1902
    @nandy1902 3 роки тому

    Can we use testng listeners,testng assertion in this framework or it should be completely depends on junit????

  • @sumeshm23
    @sumeshm23 3 роки тому

    Can we use dataprovider in cucumber ?
    Can we run the same testrunner class using junit and testng

  • @anushapattan9638
    @anushapattan9638 3 роки тому

    Any plans on resuming Protractor Series with Jasmine framework @Naveen.

  • @sandeepunique6237
    @sandeepunique6237 3 роки тому

    Hi Naveen, i am getting build failure while using the cucumber extent report adaptor and webdriver manager in pom.xml.. could you please provide me the solution for this

  • @anusophiakarthikeyan2155
    @anusophiakarthikeyan2155 9 місяців тому

    Hi ,
    I could not excute mvn verify command in terminal.please some one help me.

  • @user-yt1dv1yr2x
    @user-yt1dv1yr2x Рік тому

    Hi Naveen, I followed the same pattern of yours but feature files are running sequential it is not running in Parallel. Kindly help me on this issue

  • @saidayapule445
    @saidayapule445 3 роки тому

    Hi Naveen,I added Testtime:test-output-thread in Test Runner,To see report in terms of Threads,All the execution is fine, But when i copy the index.html path and paste in browser,The report is not getting loaded,It shows blank with reset Button,Can you let me know why,Thanks

  • @pritenpatel1438
    @pritenpatel1438 2 роки тому

    Hi Naveen, Thank you so much for the videos. I wanted to ask you few cross browser questions. How can I execute the feature file on different browsers in Parallel.?
    Also, how can I run the entire suite on Chromebrowser and after the test is done, How can I immediately start the test execution to happen on IE. I want the Test to be triggered just once and it should automatically start the test on IE after it has finished the testing on Chrome.

    • @shadygaming8454
      @shadygaming8454 2 роки тому

      good one Priten, did you find any solution for this?

  • @Nykster
    @Nykster 3 роки тому

    On Cucumber WebUI report, how do your variables appear in a table?

  • @sridhar6358
    @sridhar6358 2 роки тому

    Testng parallel mode: if i run the parallel Test runner, i am able to run all the tests parallely at scenario level, but if i run the tests in parallel from command prompt as : mvn verify they are not working

  • @neeraj155
    @neeraj155 3 роки тому

    Hello Naveen I am trying to automation testing for a chatbot any idea how to achieve it..chatbot using websocket api

  • @jainamit2208
    @jainamit2208 Рік тому

    Can we run feature level parallel execution in testng ? And how

  • @palashchatterjee1454
    @palashchatterjee1454 2 роки тому

    @Naveen Thanks for such a nice video.
    But while using mvn verify from cmd, First the scenarios are running one-by-one, after completion then parallel execution is starting.
    Could you help to resolve this.
    Thanks.

    • @nityaranjan6714
      @nityaranjan6714 2 роки тому

      Can you please share your code base or github link

  • @sowndaryasri4189
    @sowndaryasri4189 3 роки тому

    Hi Naveen , I have a question regarding parallel execution in cucumber in a specific order.
    I am using Selenium, Java, Cucumber, Junit in my automation framework. I have 20 features in my regression suite which uses 2 set of login credentials to execute the testcase ( 10 features use USER1, remaining 10 features use USER2 credentials to login and proceed with the test ) The limitation in the application under test is it will not allow the same user to login in separate browsers at the same time. I wanted to achieve parallel execution in 2 threads specifying all the features which uses USER1 credentials to run in one thread and the remaining 10 features which uses USER2 credentials in another thread
    Could any one please let me know how to achieve this?

  • @Sumit0408
    @Sumit0408 3 роки тому

    Hi Naveen, Can u please share the failsafe dependency plugin added in POM

  • @krsnarayana
    @krsnarayana 3 роки тому

    Could you please make a video on cucumber Junit with Cross-browser parallel testing

  • @brajeshsahu3323
    @brajeshsahu3323 3 роки тому

    Can you please let me know how we can achieve the same using Gradle?

  • @SOBHITSHARMA
    @SOBHITSHARMA 3 роки тому

    Thanks for the video but i dont think its idol. We will have 40 features with more than 5 scenario each, if we use this then 40 chrome instances will be created at once but i think idol would be keep thread count 4 then first 4 feature file execution and any thread is free next feature file would be picked. Thoughts …????

    • @gayathrivr
      @gayathrivr 2 роки тому

      @Jay Radadiya Did you sort out the issue? I am getting the same issue

  • @sridhar6358
    @sridhar6358 2 роки тому

    what is the need of fail-safe plugin in parallel execution

  • @MadirajuKChaitanya
    @MadirajuKChaitanya 3 роки тому +2

    Hi @Naveen Sir, thanks a lot for sharing this information. I tried executing the Test Runner file from both Eclipse IDE and the Command Prompt. But in my case, in both these cases, my feature files are not executing in parallel. Can you please let me know...where the error could be...?. I wrote the scripts the same way as mentioned in the video. Thanks, in advance.

    • @swethaputti
      @swethaputti 3 роки тому +3

      Even i am not getting parallel execution

    • @vs8738
      @vs8738 3 роки тому +2

      @@swethaputti Any luck? as its happening sequential rather than parallel. Hello @Naveen can u please advise.

    • @vs8738
      @vs8738 3 роки тому

      Hi @Madiraju K Chaitanya any luck?

    • @automationneemo
      @automationneemo 3 роки тому +2

      Please make sure you are not mixing testng and junit together. Better remove testng dependencies and try

    • @shadmairam2549
      @shadmairam2549 3 роки тому +1

      @@automationneemo Yes, the problem was sorted when testng dependencies were removed.Thanks!

  • @Arshadarsh
    @Arshadarsh Рік тому

    It's not working for me in maven cmnd promt please guid me

  • @Gurudharshini29
    @Gurudharshini29 3 роки тому

    Hi Naveen, I am unable to cucmber test through maven command in mac os. Getting as "mvn command not found " in cmd prompt.

    • @souravpoddar1050
      @souravpoddar1050 3 роки тому

      Install Maven in your local. Add it to environment variables as "Path".

  • @andhavarapuanusha4571
    @andhavarapuanusha4571 2 роки тому

    Hi can anyone say how to run particular feature file using maven surefire plugin.

  • @anshuyadav9248
    @anshuyadav9248 3 роки тому

    Thanks

  • @AtheistMrSingh
    @AtheistMrSingh 3 роки тому

    hi Naveen, I try to run on Terminal using mvn verify and and also with mvn clean test. but tests wont get executed i.e. browser does not start at all. and I dont get | TESTS | but I get Build Success.
    Please give your insight.

    • @Nykster
      @Nykster 3 роки тому +1

      remove testng dependencies then should work... I had the same issue but now ok

  • @SingaporeChinnodu
    @SingaporeChinnodu 3 роки тому

    Hi Naveen,
    The telegram link in description is not working.
    Could u tell the group name?

  • @nikhilkanojia1683
    @nikhilkanojia1683 3 роки тому

    Please share the github link for this code, as this is not working for me in parallel.

  • @dhanapalayyanar1394
    @dhanapalayyanar1394 3 роки тому

    Hi Naveen ,
    Could you please make a video on cucumber with Excel sheet..like data provider we have in testng

  • @viveksharma-mh7pz
    @viveksharma-mh7pz 3 роки тому

    If we have 40 feature files and desired to run only 8 out of them...How can we do this?

  • @jparekh59
    @jparekh59 3 роки тому

    Has anybody faced this?
    mvn verify executes duplicate tests.
    when executed "mvn verify" then it will execute each tests with a single browser at a time, and once that completed it will continue the test and will run all of them again where as a part of parallel testing and multiple tests will be executed together.

    • @langtu103
      @langtu103 3 роки тому

      I have the same issue. is this resolve or not?

  • @suneelss2590
    @suneelss2590 3 роки тому

    Hi Naveen from where can i get code,please share me git details

  • @Al-oh9yr
    @Al-oh9yr Рік тому

    Hi bro can you please provide the git hub code for this please?

  • @Psai4456
    @Psai4456 2 роки тому

    How to run 100 feature files sequence order not parallel

  • @akshatvohra6
    @akshatvohra6 3 роки тому

    Not able to run features file in parallel. they are running sequentially. please help.

    • @Nykster
      @Nykster 3 роки тому

      remove testng dependencies from POM then should work... I had the same issue but now ok

  • @samratk4097
    @samratk4097 3 роки тому

    Hi Naveen, could you please provide me git url for this code

  • @manjunathrajeev2481
    @manjunathrajeev2481 3 роки тому

    I followed all the steps shown in video but For me feature files are not executing in parallel. Please help me out in configuring feature file parallel execution

    • @paulnapadao4093
      @paulnapadao4093 3 роки тому

      Hi Rajeev. I'm having the same issue, I have 3 feature files but they are not executing in 3 browsers. are you able to resolve your problem?

    • @Al-oh9yr
      @Al-oh9yr Рік тому

      @@paulnapadao4093 did you manage to fix the usage?

  • @sridhar6358
    @sridhar6358 2 роки тому

    parallel execution is not working all the tests are executing in one single thread

  • @abhishekcardigan3770
    @abhishekcardigan3770 3 роки тому

    Hey Navee, did exactly the same whatever you have done but I am not able to achieve parallel execution.
    What might be the issue? It is opening one browser only.

    • @waahresindhiyon4689
      @waahresindhiyon4689 3 роки тому

      same case with me

    • @Nykster
      @Nykster 3 роки тому

      @@waahresindhiyon4689 remove testng dependencies from POM then should work... I had the same issue but now ok

    • @nityaranjan6714
      @nityaranjan6714 2 роки тому

      same with me

    • @nityaranjan6714
      @nityaranjan6714 2 роки тому

      @@Nykster I did it. But still no parallel execution is happening

    • @Nykster
      @Nykster 2 роки тому

      Double check there are no testng dependencies at all. Like all should be removed

  • @vikrantshingne8761
    @vikrantshingne8761 3 роки тому

    Can I get git repository link

  • @nagamanickam5702
    @nagamanickam5702 3 роки тому

    Please use gradle, maven is too lengthy and complex

  • @waahresindhiyon4689
    @waahresindhiyon4689 3 роки тому

    Anyone facing the issue that parallel execution is not happening

    • @Nykster
      @Nykster 3 роки тому

      remove testng dependencies from POM then should work... I had the same issue but now ok

    • @paulnapadao4093
      @paulnapadao4093 3 роки тому

      Hi @@Nykster didn't work for me. would you able to give me some advice on what could be the cause please?

    • @Nykster
      @Nykster 3 роки тому

      @@paulnapadao4093 There are 3 test-ng dependencies, did you remove all?

    • @paulnapadao4093
      @paulnapadao4093 3 роки тому +1

      Hi@@NyksterYes I'd removed it all. but I was able to make it work by adding this dependency..
      org.projectlombok
      lombok
      1.18.20

    • @Nykster
      @Nykster 3 роки тому

      @@paulnapadao4093 OK fantastic ☺

  • @JitendraAgrawalEngineer
    @JitendraAgrawalEngineer 2 роки тому

    Hi @Naveen Sir, I tried to execute parallelly using maven but was unable to execute While I added the POM.XML file according to you and I have maven already installed in my system.
    org.apache.maven.plugins
    maven-failsafe-plugin
    3.0.0-M4



    integration-test



    **/MyTestRunner.java

    methods
    6
    true

  • @shruthim984
    @shruthim984 2 роки тому +1

    hi Naveen, I followed the same steps for parallel execution when i run through cmd it is running in sequential instead of parallel. I also tried removing the testng dependncy(org.testng/testng). after removing the dependency am getting error "org.testng.xml.XmlSuite.setParallel(Ljava/lang/String;)V"
    Please can you guide me

    • @priyaauti5547
      @priyaauti5547 2 роки тому

      I am also facing the same issue . It run sequentail instead of parallel

    • @492832
      @492832 2 дні тому

      Hi @shruthim984, Try to update your surefire plugin version. I have changed it from 3.0.0-M5 to 3.0.0-M6 and it's working for me.
      org.apache.maven.plugins
      maven-surefire-plugin
      3.0.0-M6