Can a Test Factory call another Test Factory?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Can a Test Factory call another Test Factory?

bipo1980
Need a direction. I have searched everywhere but could not get an answer whether a test factory can call another test factory.

Example : the first test factory gets me the test suites and for each suite, another test factory is called that will get the test cases for that suite.

Here's a sample code:

Expected Result:
Executing Test Suite Suite#1, Test Case: 1
Executing Test Suite Suite#1, Test Case: 2
Executing Test Suite Suite#2, Test Case: 1
Executing Test Suite Suite#3, Test Case: 2

public class clsTestSuites{

   
/*********************************************
    * WILL GENERATE INSTANCE TO TEST EACH TEST SUITE
    *
    ***********************************************/
   
   
@Factory(dataProvider="dataSuites")
   
public Object[] createTestSuites(int id, String TestSuite) {        
       
return new Object[] {new clsTestCases(id, TestSuite)};        
   
}

   
@DataProvider(name="dataSuites")
   
public static Object[][] dataProviderForTestSuites() {
       
Object[][] dataArray = {{1, "Suite#1"},{2, "Suite#2"}};
       
return dataArray;
   
}
}

public class clsTestCases{  
   
/*********************************************
    * THE INTENT FOR THIS CLASS IS:
    * 1. To Use a combination of Test Factory + Data Provider + Test Method to test each test case in a test suite
    *
    * 2. It works if i just use a Data Provider + a Test Method. But i want to know if a Test Factory can also be used.
    *
    ***********************************************/
   

   
private int TestSuiteId;
   
private String TestSuiteName;

   
public void runTestCases(int id, String TestCase) {
       
System.out.println("Executing Test Suite " +TestSuiteName + ", Test Case No: " +TestCaseNo);
        assertTrue
(true);
   
}
}



--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Loading...