量角器 - 在不同的浏览器并行运行多个测试 [英] Protractor - run multiple tests in parallel on different browsers

查看:289
本文介绍了量角器 - 在不同的浏览器并行运行多个测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法找到如何设置此的任何信息,但它似乎是一个pretty基本概念,所以我敢肯定有一个答案在那里。

I can't find any information on how to set this up, but it seems like a pretty basic concept, so I'm sure there's an answer out there.

我知道如何在配置设置的能力 browserName 属性对象运行在不同浏览器量角器。这就是伟大的工作。我可以将其设置为'铬''火狐'或什么,我需要它如预期只是运行。但是,为了运行单个测试套件对多个浏览器(据我所知)的唯一方法是创建单独的配置文件,每一个不同的 browserName 然后运行每个浏览器与它自己的配置。这工作,但它真的很慢,因为测试然后按顺序运行,而不是同时进行。

I know how to run protractor on different browsers by setting the browserName property of the capabilities object in the config. And that's working great. I can set it to 'chrome' or 'firefox' or whatever I need and it runs just as expected. But the only way to run a single test suite against multiple browsers (as far as I know) is to create separate config files, each with a different browserName and then run each browser with its own config. This works, but its really slow because tests are then running in sequence, rather than concurrently.

请问有什么办法可以并行在多个浏览器运行呢?

Is there any way to run it on multiple browsers in parallel?

它可以用做SauceLabs?甚至使用本地硒网格?

Can it be done on SauceLabs? or even using a local Selenium-Grid?

我们只是想简化我们的测试过程中,这将是一个巨大的帮助。任何建议或信息将是极大的AP preciated。先谢谢了。

We are just trying to streamline our testing process and this would be a huge help. Any suggestions or info would be greatly appreciated. Thanks in advance.

推荐答案

更新2014年2月 - 这个答案是不再有效。使用下面保罗·莫雷蒂的答案。

有可能是一个更好的办法做到这一点,但现在我只是在执行这些并发咕噜任务。

There may be a better way to do this but currently I am just executing these as concurrent Grunt tasks.

1)添加咕噜并发插件

1) Add the grunt concurrent plugin

npm install grunt-concurrent --save-dev

2)添加一个任务grunt.initConfig下每个浏览器。我们可以添加浏览器作为ARG再次使用我们的配置文件

2) Add a task for each browser under grunt.initConfig. We can add the browser as an arg to re-use our configuration file.

protractor: {
        options: {
            keepAlive: true,
            singleRun: false,
            configFile: "test/protractor.conf.js"
        },
        run_chrome: {
            options: {
                args: {
                    browser: "chrome"
                }
            }
        },
        run_firefox: {
            options: {
                args: {
                    browser: "firefox"
                }
            }
        }
    },

3)注册这些作为任务;

3) Register these as tasks;

grunt.registerTask('protractor-chrome', ['protractor:run_chrome']);
grunt.registerTask('protractor-firefox', ['protractor:run_firefox']);

4)grunt.initConfig下创建的并发任务

4) Create your concurrent task under grunt.initConfig

concurrent: {
        protractor_test: ['protractor-chrome', 'protractor-firefox']
    },

5)增加繁重的任务并发

5) Add the grunt task for concurrent

grunt.registerTask('protractor-e2e', ['concurrent:protractor_test']);

和执行,应该给你的并发测试量角器

And executing that should give you concurrent protractor tests.

这篇关于量角器 - 在不同的浏览器并行运行多个测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆