Selenium Framework for Beginners 23 | TestNG Grouping | How to group tests

Поділитися
Вставка
  • Опубліковано 2 гру 2024

КОМЕНТАРІ • 72

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

    Hello Raghav, Your videos helped me a lot to get a JOB in Accenture as "Test Automation lead" 7 months before . and am so happy in my work . If i have some doubts on any area I come back and refer your video again :)

  • @ashesds1
    @ashesds1 4 роки тому +2

    One interesting point. If you have methods annotated with BeforeTest,BeforeSuite etc they will not be run automatically if they are not included in the groups also. If we want the setup and tear down methods to run irrespective of your group classifications we could use alwayrun=true for the Before and after methods

    • @RaghavPal
      @RaghavPal  4 роки тому

      Thanks for the inputs Ashes

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

      Thank you !!! i don't even want to know how long i would be trying to find out, whats wrong .. again... 🤬😅

  • @prashantht.v8289
    @prashantht.v8289 5 років тому +1

    Very neat and crisp explanation.. Very good job.

    • @RaghavPal
      @RaghavPal  5 років тому

      Thanks for watching Prashanth

    • @RaghavPal
      @RaghavPal  5 років тому

      Thanks for watching Prashanth

  • @ravikumarshallagi9755
    @ravikumarshallagi9755 6 років тому +4

    There is a typo in d test for Regression vs xml not sure if exclude worked correctly. vl hv to check ourselves to see..
    You r doing good job.. Thanks for d content..

    • @RaghavPal
      @RaghavPal  6 років тому

      Hi Ravi, will check it. Thanks for your message

    • @aakash3940
      @aakash3940 4 роки тому

      @@RaghavPal It got excluded.

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

    really wonderfull series...very much seful to me...thank u

  • @fezacell2426
    @fezacell2426 5 років тому +1

    There is a type on the multiple group example. If a test method belongs to both included and excluded group, the excluded group takes the priority and the test method will be excluded from the test execution.

    • @RaghavPal
      @RaghavPal  5 років тому

      Thanks for info addition

  • @AC-vt1nq
    @AC-vt1nq 2 роки тому

    Excellent!!

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

    Thank you for in detail explained.

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

    Very good👍

  • @TahayariDan
    @TahayariDan 6 років тому

    This actually was useful ! Thank you very much for making this video and this playlist.

    • @RaghavPal
      @RaghavPal  6 років тому

      You're welcome Tahayari

  • @EasyWayLearn
    @EasyWayLearn 4 роки тому

    great explaination

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

    Hello Raghav,
    I was wondering if its possible to execute certain tests only when the combination of groups match. For example, if one test has groups as "app" and "sanity" And There are other test methods present as well in the project/class. I want to executive tests which have "app" And "sanity" tags only and tests which have only app or sanity tags shouldn't run, is this possible? If so could you share some reference please?
    Thank you in advance.

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

      Hi Dinesh, you can create a separate testng.xml file and in that include the groups you need, So when you run this file, only the included groups will execute
      This link has good examples - www.javatpoint.com/testng-groups

  • @ChandraShekar-nu8yq
    @ChandraShekar-nu8yq 5 років тому

    very nice and clear thanks a lot...

    • @RaghavPal
      @RaghavPal  5 років тому

      You're welcome Chandra

  • @kishore76dhaka
    @kishore76dhaka 4 роки тому

    God Bless you my friend

    • @RaghavPal
      @RaghavPal  4 роки тому

      Thanks for the wishes Towhid

  • @dipankarnag9537
    @dipankarnag9537 6 років тому

    Nice Explanation sir

  • @svpradeep
    @svpradeep 5 років тому +1

    Hello Raghav, thanks for the above,
    clarification - can we club groups+parameters for parallel testing on testng.xml and run them

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Pradeep, you should be able to do that. Pls try

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

    Thank you

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

      You're welcome Shafeek

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

    Thanks for another great video. There's something I'm stuck on. I have a class with multiple tests in it as per your example here. The results that get reported on the HTML report say the number of tests run is 1. It equates running one class with running one test when it reports. Is it possible to get it to report three tests run when I run one class with three tests in it, as per your example?

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

      Phil
      Yes, it is possible to get your test report to report three tests run when you run one class with three tests in it. To do this, you need to use a different test reporting tool.
      The default test reporting tool in Selenium Java is the JUnit test runner. The JUnit test runner only reports the number of test classes that were executed, not the number of test methods.
      To get a more detailed test report, you can use a different test reporting tool, such as TestNG or Allure Report. TestNG and Allure Report can both report the number of test methods that were executed, as well as the number of test classes.
      To use TestNG or Allure Report with Selenium Java, you need to add the appropriate dependency to your project. You can do this using Maven or Gradle.
      Once you have added the TestNG or Allure Report dependency to your project, you need to configure your test classes to use the appropriate test runner. To do this, you can use the `@Test` annotation.
      Here is an example of how to configure a test class to use the TestNG test runner:
      ```java
      import org.testng.annotations.Test;
      public class MyTestClass {
      @Test
      public void test1() {
      // ...
      }
      @Test
      public void test2() {
      // ...
      }
      @Test
      public void test3() {
      // ...
      }
      }
      ```
      To run your test class using TestNG, you can use the following command:
      ```
      testng MyTestClass.java
      ```
      To run your test class using Allure Report, you can use the following command:
      ```
      allure generate allure-results --clean -o allure-report
      ```
      Once you have run your test class, you can view the test report in your web browser. The test report will show you the number of test methods that were executed, as well as the number of test classes.
      I hope this helps

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

      @@RaghavPal Thank you so much for your detailed reply. What you wrote is what you showed in your video. That uses TestNG and so did I. When I open the html report it says 1 test was run despite it being 3 tests in 1 class. It reports class numbers and calls them tests while not reporting actual test numbers. That is TestNG doing that. I think it's because in the .xml file that class sits in a single tag. I need multiple such tags with different classes in them to show I want multiple tests reported. By doing that, I get multiple browser windows opening which is slower and potentially overloads the computer if I have hundreds of tests.
      My guess it what I'm hoping for is just not how TestNG works. I don't know why though. It seems fairly obvious to me that a class is not the same thing as a test, yet that's how it's categorised in the html report.

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

      may be the case, if I get to know more on this will share

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

      @@RaghavPal Thank you. I really appreciate your fantastic channel. 👍

  • @divyangjani7600
    @divyangjani7600 5 років тому

    excellent

    • @RaghavPal
      @RaghavPal  5 років тому

      Thanks for watching Divyang

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

    Hi Raghav..Thank u for the amazing content. Is it possible to control test case execution from datasheet instead of groups. Like can we provide in the datasheet with a column named"Execution Required" with value"Y/N" for each test case name.

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

      Yes, Puja you can do, will have to add script for that

  • @virenkumar3848
    @virenkumar3848 5 років тому

    love u bro thanx thanx..

    • @RaghavPal
      @RaghavPal  5 років тому

      You're welcome Biren

  • @AmitKumar-pc8wr
    @AmitKumar-pc8wr 4 роки тому

    Hi Raghav. Thanks for the video.
    Need help on this. I want to take group tags from my properties file. How to achieve that.

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Hi Amit, are you talking about parameterising the tags. Will need to check online

  • @divyangjani7600
    @divyangjani7600 4 роки тому

    what if there one group defined at class level . but one of method inside that class we are excluding it from testng.xml
    now if we run class
    will it run that method too?
    because method we are excluding but it is still under that class???

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Hi Divyang, I will need to try this. Can you try and check what happens

  • @basirobaidi667
    @basirobaidi667 5 років тому

    Thank you. Q? How to execute test cases from multiple classes using group?

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Basir, you should be able to run them using testng.xml file. There are some videos to help - ua-cam.com/play/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa.html

  • @hukamchand330
    @hukamchand330 5 років тому

    Hi Raghav, Very good explanation.
    I have one question, something like this we can using "Batch" in testNG. What is the difference between batch and groups and when to use which one ?

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Hukam, can you show me some example or link where batch is used, so I can refer and check

  • @Rahulsingh-wu4ni
    @Rahulsingh-wu4ni 4 роки тому

    Sir, I have created a TestNG class or XML file but out is coming not correct.
    And I also use include in XML is still not working.

    • @RaghavPal
      @RaghavPal  4 роки тому +1

      Hi Rahul, will need to check the setup and logs

  • @justforyou9630
    @justforyou9630 4 роки тому

    Hello sir, my groups does not work if we have before annotation , non of the before annotation execute if we do grouping . any solution other than Always = true?

    • @RaghavPal
      @RaghavPal  4 роки тому

      Hi, I checked online and looks like enabling the attribute alwaysRun=true is the solution for this. I will check more and update if I find anything on this
      stackoverflow.com/questions/46405840/before-suite-and-beforetest-methods-are-not-called-if-groups-are-executed-in-t

  • @ankitathakur1930
    @ankitathakur1930 4 роки тому

    Hi Raghav, Here you have all @test annotation in a single class file. My question is if there are... lets say 100 class files, then does all need to be included in class tag ...can we have groups for classes?

    • @RaghavPal
      @RaghavPal  4 роки тому

      Hi Ankita, yes, we can create groups as we like and also do tagging

    • @RaghavPal
      @RaghavPal  4 роки тому

      Hi Ankita, yes, we can create groups as we like and also do tagging

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

      @raghavpal I have the same question . do we need to include multiple class names in the testng.xml?

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

    What is the difference by adding groups in test level vs suite level...Even though you explained in words ...I am not getting that part. Please explain with some example while reply .Thanks!

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

      Hi Daniel, sure, I will plan to add more examples

  • @jneeraj2011
    @jneeraj2011 5 років тому

    i am not getting auto suggest in testng.xml file ..please suggest raghav.

    • @RaghavPal
      @RaghavPal  5 років тому

      Hi Neeraj, can try to restart eclipse

    • @agreeamerica7620
      @agreeamerica7620 5 років тому

      @@RaghavPal I have the same issue on my Mac and tried to restart eclipse but didn't work.

  • @Deniz-ss1sv
    @Deniz-ss1sv 3 роки тому

    :)