【问题标题】:Executing parallel tests in a Selenium keyword driven framework在 Selenium 关键字驱动的框架中执行并行测试
【发布时间】: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


    【解决方案1】:

    一个解决方案可以是:

    1. 拥有要执行的案例主表,作为您的套件。
    2. 让您的数据提供者阅读此主工作表并拥有一个接收测试用例数据参数的@Test 方法。 这个测试用例基本上读取步骤并执行 - 类似于您的 ReadAnExecureTestCase 方法。
    3. 使此数据提供程序并行并使用数据提供程序线程数进行控制。

    【讨论】:

    • 听起来像一个解决方案。让我试一试。谢谢。完成后会回来。
    • 嗨,Zeeshan,你解决了这个问题吗,我也面临同样的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-23
    • 2019-03-20
    • 1970-01-01
    • 1970-01-01
    • 2013-06-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多