Multiple OS, browsers for parallel execution using

2019-07-29 06:12发布

I'm using QAF Automation framework with Selenium Web Driver, Java, TestNG and been successful in executing one test at a time, remotely on Sauce labs. But my test executes for Windows OS, when I want it to execute on Mac OS. Not sure why windows is being selected by default.

The only properties I provided are:

remote.server=http://username:ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub
remote.port=80
driver.name=chromeRemoteDriver

Where should I mention in QAF Framework?

  1. multiple OS - Windows or Mac OS

  2. different browsers to use - Firefox, Chrome, Safari and IE.

I tried OS/browsers in config.xml file (testng.xml) as parameters but not sure why it's not working.

If you've worked with QAF frameworks before and successful with sauce parallel execution, please help!

2条回答
何必那么认真
2楼-- · 2019-07-29 06:33
  1. To use different browsers you need to set appropriate value for driver.name
  2. To set capabilities eithre provide capability as map or

<driver>.additional.capabilities={'<capabilityname1>'='<value1>','<capabilityname2>'=<value2>}

or

<driver>.capabilities.<capabilityName1>=c1value <driver>.capabilities.<capabilityName2>=c2value

Refer setting driver capabilities for detailed documentation.

查看更多
不美不萌又怎样
3楼-- · 2019-07-29 06:36

You can use Sauce Labs Platform Configurator to correctly configure the required test capabilities for your Appium and Selenium tests. It will generate code fore capabilities to use. For example, on selecting Api -> Selenium, Device -> Mac, Operating system - >Mac OS Sierra, Browser -> Chrome 61.0 it will generate following java code.

DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("platform", "macOS 10.12");
caps.setCapability("version", "61.0");

When usig QAF you can provide capability using property as below

driver.name=chromeRemoteDriver
chrome.additional.capabilities={'platform': 'macOS 10.12','version': '61.0'}

You can use different combinations as documented in setting driver capabilities.

If you want to run your test on different browser/os combination you can do it in config file. Here is the example configuration file

  <suite name="AUT Test Automation" verbose="0" parallel="true">
  <parameter name="chrome.capabilities.version" value="61.0" />
  <parameter name="firefox.capabilities.version" value="55.0" />
  <test name="Tests on Mac Chrome">
        <parameter name="driver.name" value="chromeRemoteDriver" />
        <parameter name="chrome.capabilities.platform" value="macOS 10.12" />           
        ...
  </test>
  <test name="Tests on Windows Chrome">
        <parameter name="driver.name" value="chromeRemoteDriver" />
        <parameter name="chrome.capabilities.platform" value="Windows 10" />           
        ...
  </test>
  <test name="Tests on Mac Firefox">
        <parameter name="driver.name" value="firefoxRemoteDriver"/>
        <parameter name="firefox.capabilities.platform" value="macOS 10.12" />                                 

  <test name="Tests on Windows Firefox">
        <parameter name="driver.name" value="firefoxRemoteDriver"/>
        <parameter name="firefox.capabilities.platform" value="Windows 10" />                                 
        ...
  </test>
  </suite>
查看更多
登录 后发表回答