How to make a Test Factory to 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

How to make a Test Factory to 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 is a sample. Objective is: pick a test suite - for this suite, pick all test cases - execute each test case.

public class clsTestSuites{
/****
* this class contains a factory(F1) fed by a data provider(DP1)
* similar to the one below...
***

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

private int SuiteId; private String SuiteName;
 /****
* this class is intended to contain a factory(F2) fed by a different data provider(DP2)
*
* i have tried USING a factory on constructor & factory on method - both fails
*
* what works is: using a dataprovider and a test method
*
* HOWEVER - I WANT TO KNOW IF A COMBINATION OF A FACTORY + A DATAPROVIDER + A TEST METHOD WILL WORK
*
***

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

Expected result:
Executing Test Case Suite#1 - Test Case 1
Executing Test Case Suite#1 - Test Case 2 ...
Executing Test Case Suite#2 - Test Case 1
Executing Test Case Suite#2 - Test Case 2 ...

--
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...