【发布时间】:2023-04-04 22:08:02
【问题描述】:
在数据驱动的框架中,我们使用 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);
}
我不确定他们上面的例子是否是合适的方法。请求相同的建议。提前致谢。
【问题讨论】:
标签: selenium selenium-webdriver webdriver automated-tests selenium-grid