I saved all test cases in many excel files. Every sheet in the excel file is a test case.
I read all the sheets from a java class as the dataprovider.
I have only 1 test method defined in my test:
@Test(dataProvider = "testcases", dataProviderClass = TestCaseProvider.class)
public void test(TestSheet sheet) {
String name = "File: " + sheet.getFilename() + " -> Sheet: " + sheet.getSheet();
CaseExecutor executor = new CaseExecutor(sheet);
executor.start();
executor.assertPostCondition();
}
Now we have a new requirements that we should execute the tests by excel file one by one.
For example:
Excel file A has 3 sheets: SheetA1, SheetA2, SheetA3
Excel file B has 2 sheets: SheetB1, SheetB2
We must ensure the sheets in file A is: SheetA1 -> SheetA2 -> SheetA3, and the order of file B is: SheetB1 -> SheetB2
We don’t care the order for different file.
SheetA1 -> SheetB1 -> SheetA2 -> SheetA3 -> SheetB2
SheetA1 -> SheetB1 -> SheetB2 -> SheetA2 -> SheetB3
These 2 orders or other similar orders are all OK for us.
Also we use multi-thread to run our cases.
I think we have 2 solutions to meet the new requirement.
-
Bind all sheets from a file to 1 execution thread. I can set sheet index as the order.
-
Set the priority for all sheets. sheet 0 is priority 0, sheet 1 is priority 1…. then we execute all test by the priority. that means we execute the first sheet of all the excel file as the top priority. the 2nd sheet can only execute after all 1st sheet completely.
Does anyone know which solution can be implemented easily? and how to do?