TestNG How to do Parallel Testing | Selenium Parallel testing TestNG | Step by Step for Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 154

  • @tomtom5981
    @tomtom5981 5 ปีที่แล้ว +15

    Awesome dude! To the point and selfless (there were no ads interrupting the flow). Not so many guys can do half as much as you did in a span of 12 min. Thank you.

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว +1

      You're welcome Tom.

    • @keegangarrett329
      @keegangarrett329 3 ปีที่แล้ว

      You all probably dont care at all but does someone know a tool to log back into an instagram account?
      I was stupid forgot my password. I love any help you can offer me

    • @camdenlouie1424
      @camdenlouie1424 3 ปีที่แล้ว

      @Keegan Garrett instablaster ;)

    • @keegangarrett329
      @keegangarrett329 3 ปีที่แล้ว

      @Camden Louie I really appreciate your reply. I got to the site through google and im trying it out now.
      I see it takes a while so I will reply here later when my account password hopefully is recovered.

    • @keegangarrett329
      @keegangarrett329 3 ปีที่แล้ว

      @Camden Louie it did the trick and I finally got access to my account again. I'm so happy!
      Thanks so much, you saved my account!

  • @laxmi5639
    @laxmi5639 4 ปีที่แล้ว +1

    The explanation was very clear with no interruption. You also explained other small things which usually people don't do. Thanks much.

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      You are welcome Laxmi

  • @jidoshinokata
    @jidoshinokata 5 ปีที่แล้ว +3

    A smooth 12 min of valid information

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      Happy to know Gurpal

  • @rahulsingh-op9bu
    @rahulsingh-op9bu 3 ปีที่แล้ว +1

    What a content man....hila diya sirji aapne

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Thanks Rahul

  • @jayprakashshah9484
    @jayprakashshah9484 4 ปีที่แล้ว

    Sahi ja rahe ho sir. Sidha mst explain kiya.! Great

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Thanks for watching Jayprakash

  • @soumyacc4209
    @soumyacc4209 ปีที่แล้ว

    Hi Sir, Most of your videos are very easy to understand and follow. Great effort, Thanks!

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      You are most welcome Soumya

  • @yashwantihajare2990
    @yashwantihajare2990 2 ปีที่แล้ว

    Hello Sir
    Thank you for creating this video we can easily understand parallel testing

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Glad to hear that Yashwanti

  • @sindhumounika7788
    @sindhumounika7788 5 ปีที่แล้ว

    Clarity is there in vedio
    And Nice Explanation

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      Thanks Sindhu

  • @purushottamsonkusare7934
    @purushottamsonkusare7934 5 ปีที่แล้ว

    uh explained it in very simple way bro..thanks a lot

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      You're welcome Purushottam

  • @shilpamehta4113
    @shilpamehta4113 5 ปีที่แล้ว

    great vedio in parallel testing...Very thankful for sharing this.....

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      You're welcome Shilpa

  • @annasonita1186
    @annasonita1186 3 ปีที่แล้ว +1

    Thanks you for this tutorial. could you provide the video link to add testNG plugin?

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      Sure Anna th-cam.com/video/yyUyi8s42dE/w-d-xo.html

    • @annasonita1186
      @annasonita1186 3 ปีที่แล้ว

      @@RaghavPal thanks

  • @muratg9395
    @muratg9395 5 ปีที่แล้ว

    Thank you. Your videos are easy to follow and understand.

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      You're welcome Murat

  • @techgyan96k66
    @techgyan96k66 3 ปีที่แล้ว

    You r great bro!

  • @RishabhRawat_98
    @RishabhRawat_98 3 ปีที่แล้ว +1

    Sir I was facing the issue with running both methods parallely as only one of them was executing. Then I changed the driver instance to driver1 and driver2 in both methods respectively and it started running fine.

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      Thanks for sharing Rishabh

  • @abdulrahmanjasim4707
    @abdulrahmanjasim4707 3 ปีที่แล้ว

    Thank you sir for the amazing tutorial!

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Glad it was helpful!

  • @shreedharbatthad4714
    @shreedharbatthad4714 3 ปีที่แล้ว

    Great explanation sir !!!!!!
    Is this enough to explain in the interview *

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      This should be enough for any project using TestNG, you can watch all the TestNG related video of this series and should be enough for interview

  • @Bala786A
    @Bala786A 3 ปีที่แล้ว

    Thank you sir.... 👍

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Most welcome

  • @Johnny-pt5jb
    @Johnny-pt5jb 3 ปีที่แล้ว

    Clear and simple. Thanks!

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      You're welcome!

  • @samikshashukla6673
    @samikshashukla6673 4 ปีที่แล้ว +1

    Hi Raghav, if i just declare thread count as 2 or more but do not specify parallel run.
    Would class/test still run in parallel?

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      No Samiksha, have you tried that

  • @karandeepsingh5000
    @karandeepsingh5000 6 ปีที่แล้ว +1

    Wow.. Its pretty useful, May be you can also explain the parameter in the method like (threadPoolSize, Invocation count and timeout). The purpose for these parameters. Try to make more descriptive . Other wise the stuffs are pretty cool. thanks bro

    • @RaghavPal
      @RaghavPal  6 ปีที่แล้ว

      Sure Karandeep, will take that up soon

  • @prafullvispute8450
    @prafullvispute8450 3 ปีที่แล้ว

    Thanks for sharing but can you please share the same for Junit framework as well?

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      I will plan Prafull

  • @aloksharma1426
    @aloksharma1426 5 ปีที่แล้ว

    Awesome way of explanation... Great ...thanks alot brother...👍

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      You're welcome

  • @rahulvakh
    @rahulvakh ปีที่แล้ว

    @raghav can you guide me how parallel testing is done in appium?? I am using appium 2.0.

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว +1

      Hi Rahul
      To perform parallel testing in Appium, you can make use of the Appium server's new grid feature. The grid feature enables you to distribute your tests across multiple devices or emulators for faster execution.
      Here are the steps to perform parallel testing in Appium 2.0:
      Launch the Appium server with the --relaxed-security flag:
      appium --relaxed-security
      Open the Appium Desktop client and create multiple sessions by selecting the New Session option from the File menu. Configure each session with a unique device or emulator.
      Start running your tests using the Appium client or your preferred test framework. When running your tests, specify the --session-override flag and the session ID of the Appium session you want to use for each test.
      For example, if you are using Appium with Java and TestNG, you can create a TestNG XML file that specifies the tests you want to run and the Appium session ID for each test.
      Here is an example of a TestNG XML file that runs tests on two different devices:








      In this example, the deviceName parameter specifies a unique name for each device, the udid parameter specifies the device UDID, and the appiumServerUrl parameter specifies the URL of the Appium server for each device.
      When running your tests using TestNG, you can specify the TestNG XML file and the --parallel flag to run your tests in parallel:
      mvn clean test -DsuiteXmlFile=testng.xml -Dparallel=tests
      That's it! Your tests will now run in parallel across multiple devices or emulators using the Appium server's new grid feature.
      Alternatively, if you can take subscription of cloud platforms like Browserstack, Saucelabs etc. you can use their devices too

  • @PradeepKumar-tn6cf
    @PradeepKumar-tn6cf 2 ปีที่แล้ว

    Hi, for running different method in parallel way then the methods should be runnable in parallel way first. And second if we are running parallel methods test then we should test those methods in different browser to get the result quickly for parallel test cases. correct me if I am wrong

  • @komalsingh3416
    @komalsingh3416 3 ปีที่แล้ว

    Will you send me the link of testng playlist because this one is not in selenium playlist thats your first playlist .i want all testng video from you because you are very easily explain it ..and its easy to understand .

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      Hi Komal, all the testng videos are in the selenium playlist - automationstepbystep.com/

    • @komalsingh3416
      @komalsingh3416 3 ปีที่แล้ว

      @@RaghavPal thankyou sir .☺️

  • @ayushmanchaudhury7349
    @ayushmanchaudhury7349 ปีที่แล้ว

    If I want to execute test() in different class have to select parallel as classes instead method?

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Ayushman
      Yes, to execute multiple test classes in parallel using TestNG, you need to set the `parallel` attribute to `classes` in the `` tag of your testng.xml file. This will instruct TestNG to run each test class in a separate thread, potentially improving the overall test execution time.
      For example, consider the following testng.xml file:
      ```xml



      ```
      In this example, the `parallel` attribute is set to `classes`, indicating that TestNG should execute the `Test1`, `Test2`, and `Test3` classes in parallel. When you run this testng.xml file, each test class will be executed in a separate thread, potentially reducing the overall test execution time.
      Remember that parallel test execution can introduce some overhead and instability, especially if the test classes share state or resources. Use parallel execution selectively for tests that are independent and do not share state.

  • @digambardash548
    @digambardash548 4 ปีที่แล้ว +2

    What if we don't give ThreadCount, Only parallel = methods would be there . Will the methods run parallel OR methods will run sequentially using one thread OR its a compilation error ?

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Hi Digambar, just try it out. I will check too

    • @Srhnu449
      @Srhnu449 4 ปีที่แล้ว

      @@RaghavPal Methods will run in
      parallel, even though if u didn't mention Threadcount

  • @sushmashreesg5969
    @sushmashreesg5969 ปีที่แล้ว

    Hi Raghav, I have a question. How to do parallel execution if launch browser mentioned in "@BeforeClass" annotation method? Please provide your input. Thanks in advance..

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Hi Sushma, I will check on this and will try to do a session. Meanwhile, pls check online examples

  • @somrajyadav2446
    @somrajyadav2446 2 ปีที่แล้ว

    Thanks a lot!!

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      You're welcome!

  • @adikiprakash
    @adikiprakash 3 ปีที่แล้ว

    Hi Raghav
    Is there any video which will help us to execute multiple suite XML files parallely

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Hi Adiki, you can check this howtodoinjava.com/testng/testng-executing-parallel-tests/
      can take more online help

  • @funguyz123
    @funguyz123 2 ปีที่แล้ว

    Thank you for always sharing your knowledge with us, it truly helps alot. I’m trying to find if is there a way to run multiple threads based on number of data in the excel file using 1 scenario on the feature file?
    I’m using testng for my parallel execution.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว +1

      Hi Pamza, can be done, will need to add scripts for it

    • @funguyz123
      @funguyz123 2 ปีที่แล้ว

      @@RaghavPal Awesome, thank you so much, I’ll keep an eye 🙌🏽🙌🏽

  • @aloksharma1426
    @aloksharma1426 5 ปีที่แล้ว +1

    I will learn , lot from u sir , I m selenium beginner , help me sir.

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      Sure, You can go through the videos and let me know if you face any issues

    • @aloksharma1426
      @aloksharma1426 5 ปีที่แล้ว +1

      Ok Sir...Thank You...😊

  • @matofficial180
    @matofficial180 2 ปีที่แล้ว

    Hi raghav,
    First of all, your videos are nice. Currently I work on parallel execution with testNG. I have beforemethod class and aftermethod class when I open and close drivers for each method. But, I want to create n number of drivers based on thread count only once and reuse the same drivers for all methods/threads. Could you please explain how to do it in testNG

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi, you can do this in a parent class and inherit in child classes, Can check some online examples

  • @eswar2294
    @eswar2294 3 ปีที่แล้ว

    crystal clear!

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      Thanks Eswar

  • @minhtienvan1779
    @minhtienvan1779 3 ปีที่แล้ว

    Thank you very much! I have a question.
    At 8:53 why is only one browser closed? Aren't the two browsers supposed to be closed?
    I'm encountering the same problem. Could you show me how to close them all?

  • @nishalvarghese2967
    @nishalvarghese2967 3 ปีที่แล้ว

    Hi , is this called asynchronous testing.Could you please clarify it.

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Hi Nishal, not sure on approach testing

  • @ravitejasaladi4457
    @ravitejasaladi4457 5 ปีที่แล้ว +1

    When I am using page object model, I am facing issues in calling the objects from the pages. May be it's due to page factory initialization. Can you help providing any solution??

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      Hi Raviteja, what is the error. Do you have logs. PLs check with the video again in case you missed any step

    • @ravitejasaladi4457
      @ravitejasaladi4457 5 ปีที่แล้ว +1

      @@RaghavPal heyy thanks for the reply. I got it resolved. Actually I used thread safe to get the driver instance and I got some error as I initialized the page objects inside the page class using page factory.init(driver, this). The problem solved when I initialized the page objects in @test (page factory.init(driver, LOGINpage)

  • @Playlist-cj9ct
    @Playlist-cj9ct 4 ปีที่แล้ว

    Thanks Sir, very helpful... :-)

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Most welcome Namit

  • @ramanwalia007
    @ramanwalia007 4 ปีที่แล้ว

    Hi Raghav.. loved ur videos.. can u tell me if its possible to do testing on multiple browsers with multiple threads.. or we need to use grid for that

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      You can do, Se Grid is one option, then you can use some cloud services like Saucelabs and Browserstack. Can also use container engines like Docker

  • @pradoshjena1782
    @pradoshjena1782 4 ปีที่แล้ว +1

    Hi Sir, Could you please help me on How to do parallel execution using multiple user credential ?

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว +1

      Hi Pradosh, you should be able to get diff credentials from a data file. You can use data provider from testng. Check this - stackoverflow.com/questions/31521466/testng-parallel-execution-with-dataprovider

  • @sayedibrahimsadat7060
    @sayedibrahimsadat7060 4 ปีที่แล้ว

    Fantastic!

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Glad you like it Sayed

  • @michaelcyber4584
    @michaelcyber4584 4 ปีที่แล้ว

    Please do you have any video for python about this parallel testing in selenium

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Not yet Michael

  • @kapilrana2361
    @kapilrana2361 4 ปีที่แล้ว

    Hello Raghav,
    Thanks for creating this video. I need one solution to a problem.
    Actually, I have around 200 test cases to execute. All those(200 TC) I want to execute on Chrome and Firefox parallelly.
    Also, we have different user types, like admin, super admin, manager.
    Now I want to run my test cases parallelly on chrome and firefox but with different user types. This means, chrome should use Admin user credentials and firefox should use super admin user credentials.
    I don't want you to create a full video on this. If possible just suggest the approach to follow.

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Okay, you can do it through config and data files. I will plan a session

  • @samson2045
    @samson2045 ปีที่แล้ว

    Hi..I'm facing issue in parallel execution.. sequential mode test cases are running fine.. In parallel, few test cases are getting failed due to unable to click or focus element in the browser..Any suggestion to resolve this issue?

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Hi Reena
      There are a few things that you can do to resolve the issue of test cases failing due to unable to click or focus element in the browser when running in parallel with TestNG and Selenium Java:
      * Use a different browser. If you are using a single browser for all of your test cases, try using a different browser for the parallel test cases. This can help to avoid conflicts between the test cases.
      * Increase the timeout value. The timeout value is the amount of time that Selenium will wait for an element to be found or interacted with before it times out. If the timeout value is too low, the test cases may fail because they are not able to find or interact with the elements in time.
      * Use a different locator strategy. The locator strategy is the way that Selenium finds an element on the page. If the locator strategy that you are using is not working well in parallel, try using a different locator strategy.
      * Use a different thread pool. The thread pool is the number of threads that TestNG will use to run the test cases. If the thread pool is too small, the test cases may not be able to access the elements on the page in time.
      Here are some additional things to keep in mind:
      * The browser that you use for parallel test cases should be the same browser that you use for sequential test cases.
      * The timeout value should be long enough to allow the test cases to find and interact with the elements on the page.
      * The locator strategy that you use should be reliable and efficient.
      * The thread pool should be large enough to allow all of the test cases to run at the same time.
      I hope this helps

  • @AndiRHermawan
    @AndiRHermawan 6 ปีที่แล้ว

    i love your channel, keep going !

    • @RaghavPal
      @RaghavPal  6 ปีที่แล้ว

      Thanks a lot Andi

  • @UltimateCodingGuide
    @UltimateCodingGuide ปีที่แล้ว

    Hello sir i am doing parallel execution in my current project using testng but sir i have one doubt in my case lets consider chrome browser 1 and Chrome browser 2 running parallel and now if chrome browser 1 first testcase run at same time chrome browser 2 first testcase should run n so one like parallel same test should run without any time dealy even if any test fails at any browser so could you please help me and guide me how to implement this

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Hi Rushieksh
      To implement parallel execution in TestNG so that the same test runs on different browsers at the same time, you can use the following steps:
      1. Create a testng.xml file and specify the parallel attribute. The value of the parallel attribute can be "methods", "tests", "classes", or "instances". In your case, you want to run the same test on different browsers, so you would set the parallel attribute to "methods".
      2. Create a test class for each browser. In your case, you would need to create two test classes, one for Chrome browser 1 and one for Chrome browser 2.
      3. In each test class, create a method for the test that you want to run.
      4. In the testng.xml file, add the test class for each browser to the suite element.
      5. Run the testng.xml file.
      The tests will be run in parallel, and the same test will run on each browser at the same time. If a test fails on one browser, the test will not continue on the other browser.
      Here is an example of a testng.xml file that you can use:
      ```
      methods





      ```
      In this example, the parallel attribute is set to "methods", so the same test will run on Chrome browser 1 and Chrome browser 2 at the same time.
      I hope this helps

  • @rammsteiniano477
    @rammsteiniano477 6 ปีที่แล้ว

    wow so useful Thanks !

    • @RaghavPal
      @RaghavPal  6 ปีที่แล้ว

      Glad to know this

  • @michaelcyber4584
    @michaelcyber4584 4 ปีที่แล้ว

    If yes , please how do we prevent that . Incase we also want each instances having different useragent

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว +1

      Here we are using a website like a user. We can provide diff user credentials by doing parameterization

  • @viveksingla9796
    @viveksingla9796 5 ปีที่แล้ว +1

    What is user. dir that you used

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      Hi Vivek, By default the classes in the java.io package always resolve relative pathnames against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked.
      Pls check this - softwareengineering.stackexchange.com/questions/302988/trying-to-understand-on-what-user-dir-property-actually-means

  • @mathsmazzaaa4532
    @mathsmazzaaa4532 4 ปีที่แล้ว

    Hi
    I am working on Parallel Execution in testng.My test case is I wanted to create a extent report Once I ran all the test cases parallel. am getting an extent report with mix and match steps from all the test cases.Not sure how to fix this

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Hi Sirisha, you can take some help from here - stackoverflow.com/questions/52811017/extent-report-issue-parallel-testing

  • @michaelcyber4584
    @michaelcyber4584 4 ปีที่แล้ว

    When u do it in parallel, does it allow the website / browser to store cookies

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Hi Michael, storing cookies is the functionality at the website end.

  • @RajkumarChidambaram
    @RajkumarChidambaram 5 ปีที่แล้ว

    Hi, i have classA which has 4@test method in it. I have an XML file which has 4 test tags in it say iphone ipad mobile and tablet and all the 4 tests were trying to execute the same classA. Could you pls explain how to achieve parallelism in this case along with thread safety

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      Hi Raj, you can use testng.xml file as below


      Here we have a class called ClassName and all the methods inside the class with @Test annotation will be run in parallel (4 threads in parallel)

    • @RajkumarChidambaram
      @RajkumarChidambaram 5 ปีที่แล้ว

      @@RaghavPal hi, i have a doubt over here. Mentioning parallel=methods does this mean the 3 tests will be run by 3 different threads or the same thread will run all the 3 methods.

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

      The thread count is 4, so max 4 diff threads can run in parallel

  • @dhanashreesaraf2092
    @dhanashreesaraf2092 4 ปีที่แล้ว

    Hello Sir, Thank you all your trainings. They indeed help a lot. In my project I need to implement parallel execution in a Selenium with Java + cucumber framework. I have command steps in my feature files. I need to do this without maven. Can you please guide me for same.
    Thank you.

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Hi Dhanashree, you can watch the cucumber selenium tutorials here - automationstepbystep.com/

  • @3VAudioVideo
    @3VAudioVideo 2 ปีที่แล้ว

    Please do a video on how to fix issues when running parallel tests. For instance, I have a counter for reporting test steps, but in the end, the steps are out of order and even repeated. Each test case restarts at step 1, but the steps might look like this in the report: Test B: steps 1,2,3,3,3,7 Test B: steps 2,2,2,6,7 Plus steps fail. Plus I see tests that do the same steps in 2 test cases end up doing the same step into 1 browser. So if test A enters "ABC" into edit field "Address" and test B enters "123", Selenium enters "ABC123" into the field.

  • @GowriThetraveler
    @GowriThetraveler 6 ปีที่แล้ว

    Hi Raghav,
    How we can get all CSS values of headings on webpages (ex: h1, h2, h3 etc) and how can I print those in console.
    For this, Is possible by java ?
    If not possible by java which programming language Will helps to get all CSS values of headings, paragraphs etc.. on any webpages.
    Am able to get css value by finding the element in selenium ex: Driver. findelement(By.id("sample"). getcssvalue("colour"). but it won't work for all website because we have to find element.
    So, please give me any suggestions on this. Is possible to get all CSS values through any programming language?

    • @RaghavPal
      @RaghavPal  6 ปีที่แล้ว

      Hi Gowri, you can get css value by using getCssValue() method
      example element.getCssValue("font-weight");
      You can see some more information here and see how to use in your case - stackoverflow.com/questions/17255611/selenium-webdriver-getcssvalue-method

  • @prashantht.v8289
    @prashantht.v8289 5 ปีที่แล้ว

    Hi Raghav, nice video, I have one question: Can we run multiple classes in parallel

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว +1

      Hi Prashant, Yes you can, you can put classes in the parallel node.
      Here is one example www.seleniumeasy.com/testng-tutorials/parallel-execution-of-classes-in-testng

    • @capoerich
      @capoerich 4 ปีที่แล้ว

      @@RaghavPal Cool, thanks a lot. That's exactly what I was looking for.

  • @piyaasok
    @piyaasok 3 ปีที่แล้ว

    Hai Sir , How can i run a cucumber feature file from testNG test method?. Please give me some idea or reference. Please help. thanks

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Hi, I will check if I have a video on that, Can also check my playlists here - automationstepbystep.com/

    • @piyaasok
      @piyaasok 3 ปีที่แล้ว

      @@RaghavPal thank you very much. I found this is acheived using the testNGCucumberRunner. How can i add and run a maven goal for the test I want to test from intellij?

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      I will need to check on this, for now try some online examples

    • @piyaasok
      @piyaasok 3 ปีที่แล้ว

      @@RaghavPal I have tried that and made that working using the testNGcucumberRunner. Thanks

  • @harshvegada4182
    @harshvegada4182 4 ปีที่แล้ว

    Hi Raghav,
    One quick Question, Why second @Test browser not closed and failed, could you please explain

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Hi Harsh, pls point the time in the video. Will help me refer and save time

    • @harshvegada4182
      @harshvegada4182 4 ปีที่แล้ว

      @@RaghavPal On 9th minuet, my question related driver instance, driver is non-static both test method refer to single driver instance, here the question arise when run your test cases in parallel then each test should be treated as different - different thread right but its point to same. could you evaluate this.
      Thanks Harsh

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Usually this is taken care in the webdriver interface. I will still check more on this

    • @harshvegada4182
      @harshvegada4182 4 ปีที่แล้ว

      @@RaghavPal Yes, i would agree with you, i will wait for your answer

    • @harshvegada4182
      @harshvegada4182 4 ปีที่แล้ว

      Hi Raghav, did you get answer for this?

  • @PitabashTest
    @PitabashTest ปีที่แล้ว

    How to run the same test class for multiple times(50 time)

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      To run the same test class for multiple times (50 times) using TestNG, you can use the `@Test(invocationCount = 50)` annotation. This annotation will tell TestNG to run the test class 50 times.
      For example, the following code will run the test class `MyTestClass` 50 times:
      ```java
      import org.testng.annotations.Test;
      public class MyTestClass {
      @Test(invocationCount = 50)
      public void testSomething() {
      // Do something
      }
      }
      ```
      This will run the `testSomething()` method 50 times. The output of the test will be the same as if you ran the test class once, but the test will be run 50 times in parallel.
      You can also use the `threadPoolSize` attribute to specify the number of threads that TestNG should use to run the test class. For example, the following code will run the test class `MyTestClass` 50 times using 10 threads:
      ```java
      import org.testng.annotations.Test;
      public class MyTestClass {
      @Test(invocationCount = 50, threadPoolSize = 10)
      public void testSomething() {
      // Do something
      }
      }
      ```
      This will run the `testSomething()` method 50 times, but it will use 10 threads to do so. This can be helpful if you are running a test class that is CPU-intensive or if you want to test the performance of your application.
      I hope this helps

  • @yerramillivaraprasad9829
    @yerramillivaraprasad9829 ปีที่แล้ว

    Sir. I am commeting bit late. When i am trying to run parallel tests using testng two browsers are getting opened but all the inputs are going to one browser only. How go get this issue resolved.

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Hi Yerramilli
      The issue that you are facing is due to the fact that by default, TestNG uses a single thread to execute all your tests. This means that even if you are running multiple tests in parallel, they will all be executed in the same thread.
      To resolve this issue, you need to use the parallel attribute in the @Test annotation. The parallel attribute specifies the number of threads that TestNG should use to execute the test.
      For example, the following code will run the @Test annotated method in two parallel threads:
      Java
      @Test(parallel = 2)
      public void testMethod() {
      // Your test code goes here.
      }
      Once you have added the parallel attribute to your @Test annotation, TestNG will start two threads and execute the testMethod() method in each thread. This will ensure that your tests are executed in parallel and that the inputs are not going to the same browser.
      Here are some additional things to keep in mind:
      * The parallel attribute can take a value of 1 or more.
      * If you set the parallel attribute to a value greater than 1, TestNG will create a new thread for each test that you run.
      * If you are running your tests on a machine with limited resources, you may want to set the parallel attribute to a lower value
      I hope this help

    • @yerramillivaraprasad9829
      @yerramillivaraprasad9829 ปีที่แล้ว +1

      @@RaghavPal hi sir thanks a lot for your reply. Infact I am implementing testng framework in my organization by learning from your videos. The issue i faced is with the Webdriver I am using bcoz it is static and when we use static webdriver parallel runs will fail as everything will be messed up. To avoid this issue i used threadlocal. So now my script is running in parallel. Please make a video on thread local sir there are so many people who are facing this issue, if u make a video on using threadlocal it will help for many people like me.

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Sure, I will plan
      When you use a static webdriver, all threads share the same instance of the webdriver. This can cause problems if two threads are trying to interact with the same element on the page at the same time. For example, if one thread is trying to click on an element and the other thread is trying to type into the same element, the results will be unpredictable.
      Using ThreadLocal, each thread gets its own instance of the webdriver. This ensures that the threads do not interfere with each other.

  • @hmdraza
    @hmdraza 4 ปีที่แล้ว

    You missed the Failure while executing. I am getting error while executing 3 Tests parallel, you also couldn't execute. When we deal with driver object, we need to maintain session and object count also. All three Tests should have distinct WebDriver object.

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      Thanks for informing Hamid, I will check this