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

Поделиться
HTML-код
  • Опубликовано: 23 ноя 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 :)

    • @RaghavPal
      @RaghavPal  2 года назад

      All the best Shafeek

  • @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... 🤬😅

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

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

  • @AC-vt1nq
    @AC-vt1nq 2 года назад

    Excellent!!

  • @smitavharavadekar7578
    @smitavharavadekar7578 3 года назад

    Thank you for in detail explained.

    • @RaghavPal
      @RaghavPal  3 года назад

      You are welcome Smita

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

  • @akhildas6393
    @akhildas6393 2 года назад

    Very good👍

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

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

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

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

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

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

  • @divyangjani7600
    @divyangjani7600 5 лет назад

    excellent

    • @RaghavPal
      @RaghavPal  5 лет назад

      Thanks for watching Divyang

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

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

  • @shafeekmuhammed1175
    @shafeekmuhammed1175 3 года назад

    Thank you

    • @RaghavPal
      @RaghavPal  3 года назад +1

      You're welcome Shafeek

  • @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 - ruclips.net/p/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa

  • @virenkumar3848
    @virenkumar3848 5 лет назад

    love u bro thanx thanx..

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

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

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

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

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

  • @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 года назад

    :)