selenium - How to create and run xml file for multiple testNG classes in same package? -


how create , run .xml file multiple testng classes in same package?

i have 2 classes in same package , want run both of them 1 after another. guess can creating single .xml file. how can it?

here answer question:

  1. lets assume have class named class 1 follows:

    package q44015837_prioritize_multiclasses;  import org.testng.annotations.test;  public class class1  {     @test     void p1()      {         system.out.println("class1 p1");     } } 
  2. execute class1 testng test.

  3. convert class1 through convert testng.
  4. testng.xml gets generated within project space.
  5. the testng.xml follows:

<suite name="suite">    <test name="test">      <classes>        <class name="q44015837_prioritize_multiclasses.class1"/>      </classes>    </test> <!-- test -->  </suite> <!-- suite -->

  1. now lets assume have execute class named class2 follows:

    package q44015837_prioritize_multiclasses;  import org.testng.annotations.test;  public class class2  {     @test     void p2()     {         system.out.println("class2 p2");     } } 
    1. now, add entry of class2 within testng.xml follows:

<suite name="suite">    <test name="test">      <classes>        <class name="q44015837_prioritize_multiclasses.class1"/>        <class name="q44015837_prioritize_multiclasses.class2"/>      </classes>    </test> <!-- test -->  </suite> <!-- suite -->

note following have been added:

<class name="q44015837_prioritize_multiclasses.class2"/>

  1. now execute testng.xml testng suite

  2. you observe both class gets executed.

    let me know if answers question.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -