【问题标题】:Do I need to change config settings to use Selenium Grid for running multiple cucumber-jvm feature files?我是否需要更改配置设置才能使用 Selenium Grid 运行多个 cucumber-jvm 功能文件?
【发布时间】:2015-03-30 11:48:39
【问题描述】:

我有一个内部使用 Cucumber-jvm 的 maven 测试项目。我想使用 Selenium-Grid 2.0 并行运行我的功能文件。

我已经启动了集线器和节点,但是当我运行我的测试时。它仅在一个 chrome 实例中按顺序运行测试。虽然我可以在我的集线器上看到 4 个 chrome 实例。

下面是我的@Before 钩子。

@Before
    public void beforeScenario() throws Exception{
        //grid code
        DesiredCapabilities cap = new DesiredCapabilities();
        cap.setBrowserName("chrome");
        cap.setPlatform(Platform.MAC);
        cap.setCapability("version", "41");
        driver = new RemoteWebDriver(
                new URL("http://localhost:4444/wd/hub"),
                cap);

        endUser.is_the_login_page();

    }

一些帮助会很有用。 谢谢

【问题讨论】:

    标签: selenium-grid cucumber-jvm selenium-grid2


    【解决方案1】:

    您是使用一个测试类还是多个?单个测试类将单线程运行。这样就可以重用了。如果你:

    • 标记功能文件和场景@firefox 和@chrome
    • 创建挂钩以根据 @chrome 和 @firefox 标签配置 chrome 和 firefox
    • 然后使用过滤到@firefox 和@chrome 的单独测试类
    • 确保您的 junit 运行器允许分叉同时运行多个测试

    然后您应该会看到您的测试同时在两个容器中运行。

    【讨论】:

    • 你能举个例子吗?这会很有用。
    【解决方案2】:

    这应该可以通过surefire插件实现:http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html

    【讨论】:

      猜你喜欢
      • 2020-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-24
      • 1970-01-01
      相关资源
      最近更新 更多