Is there a way to run protractor tests in parallel

2019-04-28 03:05发布

I am facing synchronisation issues with my protractor tests and I would like to run my tests in parallel in contrast to my actual settings. In fact at the moment my tests run one after the other. I know how to this with TestsNG not sure how to do it with Jasmin Framework?

3条回答
何必那么认真
2楼-- · 2019-04-28 03:22
multiCapabilities: [
    {
        "browserName": "chrome",        
        shardTestFiles: true,
        maxInstances: 2,
        specs: ['login.js', 'login2.js', 'login.js', 'login2.js']
    },
    {
        "browserName": "firefox",
        "count": 1
        specs: ['login2.js']
    },
],

You can use both "count" as well "maxInstances" This is what worked best for me ..

            "browserName": "chrome",        
            shardTestFiles: true,
            maxInstances: 2,
            specs: ['login.js', 'login2.js', 'login.js', 'login2.js']

this would run 4 tests divided equally(or may not equally) in two different chrome browsers.

查看更多
迷人小祖宗
3楼-- · 2019-04-28 03:25

Since 0.19.0 version of Protractor, you can run tests in parallel using the multiCapabilities option:

protractor.conf.js

multiCapabilities: [{
  'browserName': 'chrome'
}, {
  'browserName': 'chrome'
}]

from Browser setup - Protractor docs

This issue seems to fit your case.

For now, Protractor doesn't allow to set Webdriver maxSessions option, there is a more global discussion to include this feature among others.

EDIT: multiCapabilities was introduced to run tests in parallel under different browsers, but in your case, you can use it to run multiple instances of the same ;)

查看更多
劫难
4楼-- · 2019-04-28 03:37

To split tests between two browsers,

  capabilities: {
    browserName: 'chrome',
    shardTestFiles: true,
    maxInstances: 2
  },
查看更多
登录 后发表回答