How to manually create testng xml file



In this video Tutorial, we will see How to create testng.XML file.
Many of the times in Selenium, you need testng.xml file to execute my multiple test cases in one shot.

Even for Jenkins I use this xml and pass in batch file for execution.

-~-~~-~~~-~~-~-
Please watch: “How To Create Maven build For Selenium Framework”

-~-~~-~~~-~~-~-

android eclipse tutorial for beginners

41 Comments on “How to manually create testng xml file”

  1. Hi Mukesh
    Thank you very much much for this video.
    Actually I completed Java,and full selenium course and executed it from another tutorial before I came across yours. Finally I also started page object model and almost compled. Finally 2 things left
    1. Running with testng.xml
    2. Data driven frame work adding Excel reader

    This 2 things I was failed 2 to 3 times. I kept framework aside and wasted so much time without boosting.
    I tried creating so many testng.xml but when I tried run as testng it was not showing. I saw in ur video convert into testing.xmland converted automatically it showed and running at morning 4 am

    One more excel read also I did from yours.thanks

  2. I am unable run my code using testng suite.Only difference I found in my class used is that my class has used other class within it (using object of other class).Simple class is running.Please help me out.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
    <suite name="Test" parallel="false" preserve-order="true">
    <test name="Testing all HiUp Modules">
    <classes>
    <class name="POM.SetUp"/> //running sucessfully it is simple class
    <class name="POM.LogOutModuleTest"/>

    </classes>
    </test> <!– Test –>
    </suite> <!– Suite –>

    public class LogOutModuleTest{

    Logout_Page objlogout;

    @Test
    public void LogoutTestCase ()
    {
    try
    {

    objlogout=new Logout_Page(driver);

    objlogout.logout();

    — rest of code goes here

    }

  3. Hi Mukesh,
    Can you please suggest me how to pass value to the xml file using cmd
    Iam running testNG suite with help of xml file and these xml file consist of <parameter tag> to pass input to the classes.So now i want to pass these input from command prompt how can i do that please help me with that.

  4. hi mukesh,
    can you help me to automate the gui structure of any web site or web application or even any app.
    if any tool available regarding this and its introduction.
    i want to use that with selenium webdriver (java) using eclipse.

    i hope you understand my question.

    your previous answer for me is really helpfull to create manual xml file with testNG

    thanks.

  5. Hi Mukesh!!!

    Can you please upload video tutorial of : "How to run testng.xml" file from command prompt?Also I would like to suggest you to add the link of the same step-by-step in your blog.
    It would be helpful for many people.

    Thanks in advance!!!

  6. Hello Mukesh, the latest testng.xml file seems different. i can see that currently which is different from the one i used to use previously. please let me know whether it has been updated or something else?

  7. Hi Mukesh
    this one is really good
    but i would suggest you make video that will include all the other annotations i.e groups , dependency on methods combined
    that would be really helpful
    and one question i have related to this
    when i include the methods of that particular class in xml
    it gives me error and when i remove the enclosing tag of the class , error is gone

  8. Hi Mukesh thanks for the Video

    Can you please tell me that is there any perquisites requires to install TestNg plugin in Eclipse ,I tried lot of times to install plugin via Marketplace and New Software Installation options but i am unable to install it .it throwing an error "Unable to find repository files " .
    any one can give me solution so that i can work with Testng .
    your reply would be highly appreciated.
    Thanks in advance.

  9. Hi, Mukesh,
    thanks a lot for your great work!
    I have the question – I inserted the class that has public static void main(String[] args) inside it, added @Test and imported annotations. However, Eclipse gives an error – Cannot inject @Test annotated Method [main] with [class [Ljava.lang.String;].
    Can you please explain what I'm doing wrong? Thanks a lot in advance!

  10. Hi Mukesh,

    Your videos on Selenium are really useful…I am learning a lot from all your videos…really appreciate your efforts…
    Really beneficial for all those users who are new to Selenium…. I would love to recommend to my friends.
    Keep posting new Selenium videos. All the best….keep it up.. 🙂

    Regards
    Praveen Gupta

  11. im able to run small program using testng … present im using ubuntu 14.04 selenium 2.53.0 … but it runs normally using junit and using main() method … only problem by using testng ( like):
    Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -protocol
    at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
    at com.beust.jcommander.JCommander.parse(JCommander.java:282)
    at com.beust.jcommander.JCommander.parse(JCommander.java:265)
    at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:162)

  12. Hi Mukesh, this video is really helpful. but i have one doubt like .. i have many classes in a Package, i want to run all the classes at once using testng.xml sequentially . its executing but in the random order, sometimes its executing first and last only. do i need to modify any more or need to do something. your guidance would be appreciated . Thank You 🙂

  13. Many of the times in Selenium, you need testng.xml file to execute my multiple test cases in one shot and in some cases you will not get an option to create xml from eclipse.

    Let's see how to create xml manually.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.