BrowserStack
Introduction
Alithya GoTest, by default, supports Chrome and Firefox browsers. To execute your tests over a mobile browser, you need to use a physical mobile device or any mobile device testing services like BrowserStack. BrowserStack provides Selenium hubs and Appium hubs to test browsers and mobile devices. It avoids the need for a local complex infrastructure to support every possibility. In addition, BrowserStack supports many actual mobile devices, not just mobile emulators.
See the "Testing issues without using BrowserStack" section for more details.
BrowserStack's trial limits
A trial can be requested and is provided automatically.
BrowserStack's main limits for trials are displayed here: https://www.browserstack.com/.
Additional BrowserStack tests can be requested if necessary. It is easy to adapt Alithya GoTest to a new one.
Getting a free BrowserStack trial and using it in Alithya GoTest for browsers
1A. Creating a BrowserStack trial
- Go to https://www.browserstack.com/users/sign_up
- Enter the necessary information and email. Complete the sign-up.
- Log in with your BrowserStack account.
- Go to this BrowserStack documentation page.
1B. First time using BrowserStack for browsers in Alithya GoTest
Simplified method
The simplified method below is the simplest way to use BrowserStack with browsers.
However, it allows BrowserStack to randomly choose the operating system and browser version each time an Alithya GoTest test is run.
This can break a test that otherwise works well on another configuration. This method should not be used for active scripting.
Simplified method example in Alithya GoTest
1C. Checking the results and video on BrowserStack
After automated test execution, BrowserStack provides information about the test on its end. It also includes a video of your test execution.
- Use a Chrome or Firefox browser. BrowserStack's videos don't load properly on Edge or Internet Explorer.
- Log into your BrowserStack account.
- Go to https://automate.browserstack.com/. This is specific for browser tests.
- On the centre-left or bottom-left of the screen, click a test execution.
- On the centre of the screen, you can see a video. This video represents your test executed visually.
- At the bottom of the screen, you can see various logs of your test.
1D. Choosing capabilities for BrowserStack browser tests
We want to ensure our Alithya GoTest test results with BrowserStack are consistent. Thus, capabilities should be set to ensure a specific OS, browser version, and other options, are the same from test to test.
To see the overall list, click https://www.browserstack.com/list-of-browsers-and-platforms/automate. To choose capabilities, click https://www.browserstack.com/automate/capabilities.
Example to pick capabilities for Edge browser
- Go to https://www.browserstack.com/automate/capabilities
- Scroll to the "Configure Capabilities" section.
- Click the Operating System's Listbox.
- Choose "Windows 10".
- Click the Browser's Listbox.
- Choose "18" next to Edge's icon. This will pick Edge version 18.
- To the right, the capabilities will be shown.
- Go to your Alithya GoTest project using a BrowserStack hub.
Create a variable
Type
Name
Value
Help
Dictionary
DESKTOP_CAPABILITIES_EDGE
- os=Windows
- os_version=10
- browser=Edge
- browser_version=18.0
- browserstack.local=false
- browserstack.selenium_version=3.5.2|How to create a variable |
- Go to your "Step" section, enter "OpenBrowser," and select the "Open Browser (SeleniumLibrary)" keyword.
- Modify the "Capabilities" argument of your "Open Browser" to use the variable &{DESKTOP_CAPABILITIES_EDGE}. It must use an "&" character instead of a "$" character for this case because we are accessing a dictionary variable.
- Click on the question mark icon at the top left of the grid for shortcuts to enter variables.
- Ensure the used browser is the correct one.
- Ensure your BrowserStack hub reference is correct.
- Run your test to ensure everything is correct.
- Alithya GoTest will correctly run your test.
- However, you may get an error indicating your version of Selenium or Appium is incorrect.
- Go back to BrowserStack's Capabilities, pick another Selenium version, modify your Alithya GoTest test, and try again.
1E. Scripting your Selenium tests further
If the browser you choose is "Android" or "iPhone," you may need to use the keywords "Get Source" and "Log" to fully output the webpages' XML/HTML to determine your XPaths.
Getting a free BrowserStack trial and using it in Alithya GoTest for native mobile applications
2A. Creating a BrowserStack trial
- Go to https://www.browserstack.com/users/sign_up.
- Enter the required information and email. Finish the signup.
- If necessary, log in with your new trial in BrowserStack.
- Click the menu on the top-right.
- Click "Summary".
- On the following page, click on "Settings".
- On the following page, scroll to see the "Local Testing" subsection.
- Copy the value of "Access Key" and "Local Folder" in Notepad.
- Prepare the values into this: https://testaccount325:8ekLZWpsrNJ7wYvztVA4@hub-cloud.browserstack.com/wd/hub.
- Note that the above value is the Selenium/Appium hub reference to use in Alithya GoTest.
2B. Finding native mobile application files
To test native mobile applications with BrowserStack, you need the following:
- For an Android native application, you need an APK file.
- For an iPhone native application, you need an IPA file.
APK files are easy to find on the Internet. IPA files are harder to find because they often require the source code to be compiled on a Mac computer.
For the first time, we will use Wikipedia's APK and IPA files. You can find them here: https://apps.askida.com/artifactory/webapp/#/artifacts/browse/tree/General/askida-ct-mobile-demo-app.
2C. Uploading native mobile application files to BrowserStack
The next step is to upload the APK or IPA file to your BrowserStack account. It will render it usable for your Alithya GoTest tests.
- If you are using Windows, download MINGW64 at https://sourceforge.net/projects/mingw-w64/ (or the equivalent) to send the needed "curl" command. If you are using Linux, you can send the command now.
- Prepare your curl command. -u "testaccount325:8ekLZWpsrNJ7wYvztVA4" \ -X POST "https://api-cloud.browserstack.com/app-automate/upload" \ -F "file=@C:/path/to/app/file/WikipediaSample.apk"
- Modify the pink part to your account name.
- Modify the blue part to your access key.
- Modify the orange part to the API file path or the APK file path on your computer.
The curl command you need to send is similar to: curl - Send the curl command.
- Wait for the file upload to finish.
- If it is successful, you will receive a code similar to bs://0e8366c58b6ced70b79e3e75849c33105777771c in your results.
- This code represents your native application. It will be used in your Alithya GoTest test.
2D. Determining which phone device to use in BrowserStack
- Go to https://www.browserstack.com/automate/capabilities
- On the website, change the Operating System to Android or iPhone as needed.
- As of June 4, 2019, due to the BrowserStack trial's limits, your real possible choices are the following:
- Google Pixel version 7.1
- Google Nexus version 6
- iPhone 8 Plus
- Choose your device and OS version.
- New capabilities are shown on the right. Keep a copy of them for the next section.
2E. Executing a native application test with BrowserStack in Alithya GoTest
The information from the previous sections is required. This includes:
- Your account information, such as testaccount325:8ekLZWpsrNJ7wYvztVA4.
- The application code, such as bs://0e8366c58b6ced70b79e3e75849c33105777771c of your APK file or your IPA file.
- The capabilities of the phone device, such as:
- Go to your Alithya GoTest test.
- Add the keyword "Open Application".
- Write https://testaccount325:8ekLZWpsrNJ7wYvztVA4@hub-cloud.browserstack.com/wd/hub and adapt it to your account information.
- Add the first capability "device". It will be "device" with an = sign, followed by its value.
- On the last argument, type ALT+i to add new arguments.
- Add all the necessary arguments to fit all capabilities.
- Add an argument starting with "app" and with an = sign. Add your application code, such as bs://0e8366c58b6ced70b79e3e75849c33105777771c .
- It is preferable to add the "Get Source" and "Capture Page Screenshots" (Appium version) keywords. This is to see the XML/HTML on your Android or iPhone to help you determine the XPaths to script.
2F. Checking the results and video on BrowserStack
After automated test execution, BrowserStack provides information about the test on their end. It also includes a video of your test execution.
- Use a Chrome or Firefox browser. BrowserStack's videos do not load properly on Edge or Internet Explorer.
- Log in to your BrowserStack account.
- Go to https://app-automate.browserstack.com/. This is specific to native mobile application tests.
- On the centre-left or bottom-left of the screen, click a test execution.
- On the centre of the screen, you can see a video. This video represents your test executed visually.
- At the bottom of the screen, you can see various logs of your test.
2G. Scripting your native application Appium tests further
For documentation on Appium keywords, see Mobile Testing. Please note, however, that this documentation was written without using BrowserStack.
Testing issues without using BrowserStack
Without BrowserStack or an equivalent platform, there are many complications with cross-browser testing and mobile testing.
A Selenium hub and an Appium hub need to be set up on multiple specific setups to cover every possibility.
For example:
- Microsoft Edge and Internet Explorer require a Selenium hub on a Windows machine.
- Safari requires a Selenium hub on a Mac machine.
- iPhone mobiles require the Appium hub to be installed on a Mac machine.
- Any real mobile device needs to be acquired if mobile emulators are not used.
Full licence costs
See https://www.browserstack.com/pricing for prices.
Useful links
Additional information for uploading to mobiles: https://www.browserstack.com/app-automate/appium-java Capabilities for browser testing: https://www.browserstack.com/automate/capabilities Capabilities for native mobile testing: https://www.browserstack.com/app-automate/capabilities
List of browsers/platforms: https://www.browserstack.com/list-of-browsers-and-platforms/automate
Related content
©️2023 Alithya GoTest - All Rights Reserved
Need Help? You have a suggestion?