java - testng eclipse plugin shows only last test class result when run from factory annotation -


i have test class instances created @factory annotation different parameters. when run them in eclipse testng plugin or window shows output/results shows results last test class run. other test results other test class instance runs? testng.xml :

<!doctype suite system "http://testng.org/testng-1.0.dtd"> <suite name="all tests suite">     <test name="factory test" group-by-instances="true">         <classes>             <class name="unittest.testngtestcases.factorytest"></class>         </classes>     </test> </suite> 

my factory annotated class:

package unittest.testngtestcases;  import java.util.arraylist; import java.util.list;  import org.testng.annotations.factory;  public class factorytest {       @factory     public object[] factory2()     {         system.out.println("running factory2");         list<testngtest2> list=new arraylist<>();         (int = 6; < 10; i++) {             list.add(new testngtest2(string.valueof(i)));         }         return list.toarray(new object[list.size()]);     }  } 

my test class:

package unittest.testngtestcases;  import org.testng.annotations.beforeclass; import org.testng.annotations.test;  public class testngtest2 {     private string str;     public testngtest2(string s)     {         this.str=s;     }      @beforeclass     public void bf()     {         system.out.println("running before class "+this.str);     }     @test(priority=1,groups="test1")     public void t1()     {         system.out.println("running 1"+str);     }     @test(priority=2,groups="test2")     public void t2()     {         system.out.println("running 2"+str);     }     @test(priority=3,groups="test3")     public void t3()     {         system.out.println("running 3"+str);     }     @test(priority=4,groups="test4")     public void t4()     {         system.out.println("running 4"+str);     } } 

i want test class instances run sequentially in order have been added in list of factory. done this?

tia

i've found out solution, need override tostring() method , pass every time new test name. see results. below :

@override     public string tostring()     {         return this.testname;     } 

where testname string accepted 1 of parameters of constructor of factory test class.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -