BrowserStack Testing - Without Coding
BrowserStack Testing - Without Coding
Automation is essential for web app testing. Learn to get started with automated testing on BrowserStack, without even writing any code!
Join the DZone community and get the full member experience.Join For Free
Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.
If you are part of a team developing web applications, then you should have some form of automated testing in place. It is simply not feasible to test every combination of browser, operating system, and device without some form of automation.
BrowserStack provides a service called Automate that allows you to do just that. And if take a look at the documentation, you’ll find examples of how to integrate with the Automate service from a range of programming languages and libraries.
Which is great, if you are a developer. But there are plenty of people who would benefit from writing tests who aren’t developers. Business analysists may want to validate the behavior of web apps in their domain, while designers may want to create tests as specifications for new projects.
Iridium provides a solution for those who want to take advantage of the BrowserStack Automate service without writing code. Iridium is based on Cucumber, which allows tests to be written with a natural Given/When/And/Then syntax, and tests can be written with nothing more than a text editor.
To get started, you will need to install Java 8. But don’t worry, you won’t need to write any Java code to use Iridium.
Now save the following text into a file called test.feature.
Feature: Google Test Scenario: Launch Google Given I open the page "https://google.com" When the element found by "Google Search" is present Then the browser title should be "Google"
Next, we’ll need to configure the browsers that we want to test against.
The fields that go into the XML file (i.e. platform and browserName) come from those documented here. The values can be found in the documentation for one of the libraries that Automate has documented. In the screenshot below, you can see the form that is provided in the documentation for various combinations of operating systems and browsers.
The configuration below, saved in a file called test.xml, configures Iridium to use the Edge browser in Windows.
<profile> <settings> <desiredCapabilities enabled="true" group="Edge"> <capability name="platform" value="WINDOWS"/> <capability name="browserName" value="edge"/> </desiredCapabilities> </settings> </profile>
To run the test, we’ll need a WebStart file, which will download Iridium and launch the Cucumber feature file. The javaws.testSource and javaws.configuration settings will need to be updated to reflect the paths to those files on your local system. You will also need to add your own BrowserStack security details for the javaws.browserStackUsername and javaws.browserStackAccessToken settings.
<?xml version="1.0" encoding="UTF-8"?> <jnlp spec="1.0+" codebase="https://s3.amazonaws.com/iridium-release/ "> <information> <title>Iridium</title> <vendor>Auto and General</vendor> </information> <resources> <j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se"/> <property name="jnlp.packEnabled" value="false"/> <property name="javaws.testSource" value="/Users/me/Documents/test.feature"/> <property name="javaws.configuration" value="/Users/me/Documents/test.xml"/> <property name="javaws.testDestination" value="BrowserStack"/> <property name="javaws.browserStackUsername" value="matthewcasperson2"/> <property name="javaws.browserStackAccessToken" value="accesskeygoeshere"/> <property name="javaws.openReportFile" value="true"/> <property name="javaws.saveReportsInHomeDir" value="true"/> <jar href="IridiumApplicationTesting.jar" main="true" /> </resources> <application-desc name="Web Application tester" main-class="au.com.agic.apptesting.Main"> </application-desc> <update check="timeout" policy="always"/> <security> <all-permissions/> </security> </jnlp>
Now double click on the jnlp file and Java will download and launch Iridium, and then run the test. Once completed, you will see a report file generated showing the results of the test.
And that is all you need to get started with Iridium and BrowserStack Automate. In just a few minutes, and without a single line of code, you can be running tests in the cloud against your choice of browser and operating system.
If you are interested in writing end-to-end tests like the one shown above, check out the Iridium documentation, and take a look at the course on Udemy. Iridium itself is a free and open source project on GitHub.
Opinions expressed by DZone contributors are their own.