在数据驱动框架中,我们使用Selenium和TestNG并行运行多个测试。 如何在关键字驱动的框架中实施相同的工作?
在数据驱动方法中,我们可以将每个测试用例定义为一个单独的方法,因此我们可以通过注释命令TestNG运行哪些方法以及并行运行多少个。
在关键字驱动的方法中,每个测试用例都是一个单独的Excel工作表,同一工作簿中的多个Excel工作表构成了一个测试工具包。如何对这些Excel工作表/测试用例进行注释/引用,以便与数据驱动框架中的执行结构和流程并行运行?
我想到的一个蹩脚的解决方案是混合方法,其中创建可以调用excel表的方法。
例如:
@Test
public void TestCase_001() {
// Read the keyword driven test case
// XLS_WorkbookName - The Excel Workbook or Test Suite containing multiple Test Cases
// XLS_SheetName - The Excel Sheet containing set of rows each of which contains ID of element, Operation to be performed and data to be used
ReadAndExecuteTestCase(XLS_WorkbookName_XYZ, XLS_SheetName_ABC);
}
@Test
public void TestCase_002() {
// Read the keyword driven test case
// XLS_WorkbookName - The Excel Workbook or Test Suite containing multiple Test Cases
// XLS_SheetName - The Excel Sheet containing set of rows each of which contains ID of element, Operation to be performed and data to be used
ReadAndExecuteTestCase(XLS_WorkbookName_ABC, XLS_SheetName_XYZ);
}
我不确定他们上面的例子是否适合这样做。请求相同的建议。提前谢谢。
答案 0 :(得分:1)
一种解决方案可以是: