In this article, we’ll recap some of the highlights from our live webinar, Ranorex vs. Selenium WebDriver. To view the entire recording on-demand, click here. The timing of specific topics is shown below:
It’s an old maxim that “time is money.” Ranorex is a commercial test automation solution, while Selenium is open-source. Selenium has the advantage of being free — but the time you spend developing your automation isn’t free. Ranorex Studio significantly reduces the time it takes to automate your tests. Ranorex Studio also supports testing on desktop, web, and mobile platforms.
Overview of the Selenium IDE and Ranorex Studio
Let’s begin with the scenario of a smoke test, which will check the log in feature for a website. In Selenium, you really need programming skills to build automated tests, even though Selenium offers an IDE for a low-code approach. You have to download the IDE, dependencies, driver versions of the browsers, Selenium itself, etc. For purposes of this webinar, that pre-work was already done.
Test recording with the Selenium IDE
The Selenium IDE low-code approach creates a series of recorded steps to log in and log out, that you can then replay in the Selenium IDE using the “run current test” button. The Selenium IDE is a plug-in to the Firefox browser, so you can only use Firefox to record your test. While recording the test might be successful, playing it back may not succeed if the generated test code can’t find the login fields. This type of failure has given record-and-playback a bad rap. Two tips might help: first, if the run freezes, try lowering the execution speed. Second, don’t allow the browser to “remember” any values that you put in, as this may create persistent values that affect future testing.
Test recording with Ranorex Studio
To get started, you only need to download the Ranorex application to your Windows desktop – no separate browser drivers required. For this scenario, again we’ll try a simple login/logout test on the application login. You can choose any browser from Firefox to Chrome, Edge, IE, and more.
Ranorex Studio is a full-blown test automation framework. It includes a test suite structure to organize your test cases, set up test execution, create reusable test modules, etc. A new web test suite starts off with modules to open and close the browser plus an empty recording module.
As with the Selenium IDE, you can record a test using the Ranorex Recorder. But unlike the Selenium IDE, you get a full recording control panel with tools to stop/start/pause recording, a red border to indicate UI elements you hover over them, and feedback as you record. If you make a mistake during recording, you can edit it right in the recording control panel.
Validation and test execution in Ranorex Studio
You can also create a validation step (checkpoint/assertion) during recording. For example, you can check that an object in the DOM exists, such as a welcome message or image. An important tip: No matter what tool you use, take your time. Recording faster doesn’t make your test run faster.
Out of the box, Ranorex searches for items, waiting for them to load so that you don’t have test failures caused by wait issues. And, if you made any mistakes clicking items or filling in fields, it’s very easy to edit them in the Ranorex Studio interface.
After a test executes, you get a test run report that includes screenshots so you can see exactly what happened. Finally, a Ranorex test is an .exe that is very scalable and portable. You don’t need a third party framework to execute it.
Identifying UI elements and handling dynamic objects
Why does a Ranorex test succeed in the example test scenario while the Selenium test fails? The reason is that Ranorex is better at handling dynamic objects. When the Selenium test executes a second time, it breaks because the ID of the dynamic object changed. Ranorex succeeds because it detected that the object was dynamic, and so it created an identification that would not break.
In this case, the Ranorex machine-trained algorithm identified that the login email ID used numbers, a dynamic property, which changes every time that the page is loaded. So, Ranorex automatically chose the more stable object name.
Reusable modules in Ranorex Studio vs the Selenium IDE
Ranorex Studio offers a keyword-driven framework. It’s very easy to copy test steps between modules, rename and reorganize modules. A recording such as login / logout can be broken up into individual login and log out modules, and then reused for other automated tests.
- Resolve any issues with dynamic IDs before reusing your login/logout test.
- Get your exported file into a test automation framework
- Configure all of the dependencies.
- Build a page object model framework, etc.
For purposes of the webinar, Jason chose the approach of using Visual Studio and NUnit for the test automation framework.
Managing objects with a repository
Ranorex has a built-in standalone tool Ranorex Spy to identify objects. With Selenium, you use the code inspector in the Firefox developer tools window to identify objects and resolve issues with dynamic IDs. Unfortunately, in Selenium all of this is hard-coded.
In Selenium, if you want to do data-driven testing, you have to create the necessary test harnesses. This requires at least six steps and varies depending on your specific programming language.
With Ranorex, the ability to do data-driven testing is built-in. It’s very easy to create variables for data entry, validations, and more.
- Step 1 is to create the variables.
- Step 2 is to define a data source. Ranorex supports SQL database connectors with a query builder, so it’s not necessary to know SQL. Ranorex also supports CSV files, Excel files, and simple internal data tables.
- Step 3 is to do the data binding – to connect the variables to the data source. For more in-depth information, refer to the Ranorex webinar on Data-Driven Testing.
Once everything is set up, the test will iterate once for each row in the data source.
There is limited reporting available in the test framework that you use with Selenium, but it’s not very comprehensive — it looks like a stack trace.
In Ranorex, you get a full-blown test report that is very easy to share. It’s available in standard formats including PDF, HTML, and JUnit. You can even set up automatic emails. Ranorex can capture a video report of your test run, so you can see exactly what happened during the test.
One other limitation in Selenium that works great in Ranorex – with integration to Jira, Ranorex will create a bug automatically and automatically attach the test report and the video of the test run.
Also, Ranorex can handle elements outside of the web, such as a PDF file that is embedded in the web app. This is great for end-to-end tests, where you might otherwise need other tools such as Appium.
Running a cross-technology test
As a final demonstration, Jason showed how Ranorex Studio makes it possible to test non-web elements such as a PDF download — something that is impossible with Selenium WebDriver alone.
In conclusion, Ranorex gives you day-one productivity. To see for yourself, download a free 30-day trial today.
All-in-one Test Automation
Cross-Technology | Cross-Device | Cross-Platform