Advanced Selenium Tutorial: Learn How to Do Automated Testing With Selenium
Selenium is the leading web app testing framework. Whether you’re new to Selenium or just want to make your automation smarter, you’re in the right place.
Here, you’ll get an advanced Selenium tutorial. Together, we’ll walk through the process of automated testing with Selenium step by step and provide expert advice along the way.
The Basics of Selenium
Before we get into the Selenium tutorial, let’s review some basics of Selenium itself. Selenium testing tools are comprised of Selenium IDE, Selenium WebDriver, and Selenium Grid.
- Selenium WebDriver — Browser-based driver that helps teams access and launch different browsers across different environments.
- Selenium IDE — An integrated developer environment that helps you record, edit, debug, and replay functional tests.
- Selenium Grid — Enables parallel testing on different machines against different operating systems and browsers, otherwise known as distributed test execution.
Advanced Selenium Tutorial
Learn how to run Selenium automated tests with Java and Quantum in Perfecto. Watch this advanced Selenium tutorial in step by step detail, or read below for a summary.
Watch This Selenium Tutorial
1. Install Selenium
First, you’ll need to install Selenium. You can download Selenium to get started.
2. Select a Test Framework
In the Eclipse IDE, start with a simple, responsive Java script. The one in our example tests the Boston Globe for availability within a particular zip code. For the test framework in this example, we’re using Quantum. Quantum is a BDD test framework and is Perfecto’s contribution to the open source community. So, here you have very simple Java inside of the Quantum framework.
Note that the creation of test automation scripts can be done with any framework you happen to be familiar with or any one that matches the skillsets of your automation or test engineers. For example, you can use code-based, codeless, or BDD frameworks depending on the skillsets of your team members. Whatever language your organization is familiar with, feel free to use that with the authoring of the test scripts.
3. Apply Real User Conditions
You can also apply real user simulation testing, which applies real test conditions to the test. You can test location, network coverage, and use of other applications in the background. Network virtualization allows you to get more accurate test results for the end user.
4. Add Perfecto Connect
You can also add a Perfecto Connect transport layer security tunnel to your test by adding the tunnel ID. This allows you to leverage Perfecto’s secure VPN.
5. Instantiate Web Driver Against the Test Environment
You can add a catch/try exception which comes into play if you fail to inquire about the browser selection. You can add some additional time outs to ensure your script takes screenshots from test to test, or from sections of the test.
6. Add Variables
You can opt to generate 4G LTE or a HAR file if desired. At this point you can enter in your variables which include the Boston Globe homepage in this example, the zip code, the selection of length, etc.
7. Execute the Tests
Next, run the script against your designated platforms. In this example, we’ve selected nine browser OS combinations to run against. With Perfecto, you can spin up nine virtual machines to run 198 test combinations across those various browser OS combinations, in the space of 15 minutes. See Perfecto’s supported platforms >>
8. Review Test Results
Once the tests are done, the Perfecto test lab releases the VMs and does a quick cleanup. Then, your subsequent test analytics are available inside of the report library.
With Perfecto, you can play back your tests to see what went wrong. You can play back the actual video capture itself, that you specified in your code. As the test flow is moving along, you get to see what's happening on the device as the test is running, even though the test has already concluded.
You can also capture HAR files and the device log that shows CPU utilization, Wi-Fi network, and bytes in bytes out. All of the usual device logs and statistics are available there.
9. Tag Bugs in Jira
As you examine your failed tests, you may need to send them back to your dev team. Fortunately, Perfecto has aJira integration which allows you to create a Jira ticket with the click of a button. That allows you to get the full traceability and issue tracking benefits of Jira with Perfecto.
Automated Testing With Selenium Is Better With Perfecto
Selenium is an excellent open source framework. But it can’t do it all.
Pair open source technology with Perfecto, an enterprise-grade platform with all of the devices and browsers to run your Selenium test scripts on.
With Perfecto and Selenium, you can:
- Execute web testing 50% faster than other vendors.
- Enjoy the scalability of Selenium Grid from the cloud.
- Scale your tests across multiple platforms.
- Find and fix bugs quickly with advanced test reporting.
- Integrate into your entire CI/CD toolchain.
Experience the world’s largest global testing cloud for web and mobile apps. Try Perfecto free for 14 days.