Run QMetry tests with Automate
A step-by-step guide to running QMetry tests with BrowserStack Automate
QMetry Automation Studio brings omnichannel, multi-language scripting, and reusability to automated testing. It offers scalable test automation that enables an easy transition from manual to automated testing. It supports multi-platform automated testing across web, web services/APIs, mobile, and Windows desktop.
In this guide, you will learn to:
Prerequisites
- BrowserStack Username and Access key, which you can find in your account settings. If you have not created an account yet, you can sign up for a Free Trial or purchase a plan.
- QMetry Automation Studio is installed.
- A recorded test using QAS’s recorder is available.
Running QMetry tests on BrowserStack
Update the remote.server
setting and add capabilities in the env.properties
file to run your QAS recorded test scripts on BrowserStack.
- In QAS, open the test in the Project explorer.
- In the explorer view, open the
env.properties
file in theresource/web
directory. - Update the
remote.server
setting to the BrowserStack hub URL as follows:remote.server=https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub.browserstack.com/wd/hub
- Add the required capabilities to the
chrome.additional.capabilities
settings in theenv.properties
file as follows assuming you want to test on the Chrome browser and a Windows 11 device:chrome.additional.capabilities={‘os’:’Windows’,’os_version’:’11’,’browser’:’Chrome’,’browser_version’:’latest’,’browserstack.local’:’true’,’selenium_version’:’3.14.0’,’build’:’qmetry-single’,'name': 'chrome'}
Check out the capabilities generator to learn about other capabilities that you can use.
- Update the
driver.name
parameter to theweb.config
file in theconfig
directory. As in the example we are using the Chrome browser, thedriver.name
parameter is set tochromeRemoteDriver
as follows:<suite name="Web Test" verbose="0"> <test name="Web Test1" enabled="true"> <parameter name="driver.name" value= "chromeRemoteDriver"/> <packages> <package name="tests.web"></package> <package name="tests.web.*"></package> </packages> </test> </suite>
- Run your test in your command line.
- View your test results on the BrowserStack Automate dashboard.
Testing privately hosted websites
You can test your websites that are hosted privately using the BrowserStack Local testing feature. This section will guide you through enabling Local Testing, and then using it to test websites on your work machines, CI/CD machines/nodes, and other private network configurations.
Enabling Local Testing with Automate is a two-step process:
- Establishing a Local Testing connection.
- Configuring QAS test scripts so they run through the Local Testing connection.
Establishing a Local Testing connection
You can set up the Local testing connection between your system and BrowserStack cloud using the following steps:
- Download the appropriate binary for your system:
- Unzip the binary to a folder/directory on your machine.
- Open your command-line interface and navigate to the folder containing the Local binary.
- Run the binary using the following command:
./BrowserStackLocal --key YOUR_ACCESS_KEY
BrowserStackLocal.exe --key YOUR_ACCESS_KEY
Your machine and BrowserStack Cloud remain connected unless you explicitly end the connection since the Local Testing connection is persistent. Hence, close the connection after test execution is complete.
The Local Testing setup might differ slightly based on your requirements, for example, proxy settings, restricting connections to certain domains, etc. Check out the complete list of flags to set up Local Testing for different environments or network configurations.
Configuring tests to run with Local Testing connection
- Record your test using the QAS recorder. Ensure that the site you use to create the test is a private website, such as
https://localhost.com
, etc. - In the explorer view, open the
env.properties
file in theresource/web
directory. - Add the
browserstack.local
capability and set it totrue
in thechrome.additional.capabilities
setting as follows:chrome.additional.capabilities={ 'os':'Windows', 'os_version':'11', 'browser':'Chrome', 'browser_version':'latest', 'browserstack.local':'true', 'selenium_version':'3.14.0', 'build':'qmetry-local', 'name': 'chrome'}
- Run your test in your command line.
- View your test results on the BrowserStack Automate dashboard.
Running multiple tests in parallel
In Qmetry, you can achieve parallel testing by adding additional capabilties for the combinations that you want to test on. In this example, we will run a single test script on multiple browser-device combinations, namely Chrome, Firefox, and iOS.
Use the following steps to set required capabilities and run QMetry parallel tests on BrowserStack:
- In QAS, import the recorded test.
- In the explorer view, open the
env.properties
file in theresource/web
directory. - Add capabilties for each browser-device combination as follows:
remote.server=https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub.cloud.browserstack.com/wd/hub chrome.additional.capabilities={'os':'Windows','os_version':'11','browser':'Chrome','browser_version':'latest','selenium_version':'3.14.0','build':'qmetry-parallel', 'name': 'chrome'} firefox.additional.capabilities={'os':'Windows','os_version':'11','browser':'Firefox','browser_version':'latest','selenium_version':'3.14.0','build':'qmetry-parallel', , 'name': 'firefox'} ios.additional.capabilities={'device':'iPhone 12','os_version':'14','real_mobile':'true','build':'qmetry-parallel', 'name': 'ios'}
- Update the
driver.name
parameter to theweb.config
file in theconfig
directory. As in the example we are using the Chrome browser, thedriver.name
parameter is set tochromeRemoteDriver
. As in the example, if you want to runWeb Test1
,Web Test2
,andWeb Test3
on Chrome, Firefox, and ios respectively, thedriver,name
entries are as follows:<suite name="Web Test" verbose="0" parallel='tests'> <test name="Web Test1" enabled="true"> <parameter name="driver.name" value= "chromeRemoteDriver"/> <packages> <package name="tests.web"></package> <package name="tests.web.*"></package> </packages> </test> <test name="Web Test2" enabled="true"> <parameter name="driver.name" value= "firefoxRemoteDriver"/> <packages> <package name="tests.web"></package> <package name="tests.web.*"></package> </packages> </test> <test name="Mobile Web Test3" enabled="true"> <parameter name="driver.name" value= "iosRemoteDriver"/> <packages> <package name="tests.web"></package> <package name="tests.web.*"></package> </packages> </test> </suite>
Note: For parallel tests, you don’t need to set the
driver.name
setting in theenv.properties
file. - Run your test in your command line.
- View your test results on the BrowserStack Automate dashboard.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!