Explore the Ways to Quickly Build Selenium Tests with Ranorex Webtestit: Hands-on Ranorex Webtestit Review Tutorial
If you’re like most of the testing professionals, then you are all about efficiency!
When it comes to a task like test automation, you need to focus on building tests rather than configuration and setup. You especially should not waste time in doing repetitive boilerplate code or troubleshooting the failing tests.
What You Will Learn:
Why Ranorex Webtestit?
Currently, Selenium Webdriver is the most popular solution for web test automation. It is open source, and works on major desktops & supports leading development languages. However, it is a chore to set up and requires specific expertise in Selenium to master.
One of the first setup tasks is to select an IDE. There are several IDE's that you can use with the Selenium WebDriver, such as Eclipse, IntelliJ and NetBeans. Even the old Selenium IDE has been resurrected from the grave, after going to end-of-life in 2017.
But Ranorex Webtestit is much more than just an IDE. It is a complete web testing toolset that eliminates the hassle of setting up and maintaining a Selenium Webdriver test environment.
Also Read => Ranorex Studio Tutorial
Quickly set up your test environment with Ranorex Webtestit:
Selenium WebDriver Vs Ranorex WebTestit Quick Setup:
Here is a quick comparison of the time taken for us to complete a basic setup (with exact steps to take) for Selenium WebDriver and Ranorex WebTestit.
|Selenium WebDriver (approx 2 hours to 2 days, depending on your experience)||Ranorex WebTestit (approx 15 minutes)|
|Select and install an IDE.||Install Ranorex Webtestit.|
|Install a project management tool like Apache Maven, and create a project for your test.||Configure desired endpoints using a dialog.|
|Download and configure the files needed for your project (in Java projects, all the JAR’s, libraries, etc.)||(Optional) Configure a local Selenium Grid endpoint using a dialog or use the native SauceLabs integration for cloud-based testing.|
|Install the version of Selenium WebDriver that matches the version of your target browsers.|
|Set up a Selenium server.|
|Configure testing endpoints with JSON files.|
|(Optional) Configure additional JSON files to run tests remotely or in parallel on a Selenium Grid, or to a cloud provider such as Sauce Labs.|
|Set up test execution and reporting using TestNG, JUnit, or a similar tool.|
In addition to making setup much faster, Ranorex Webtestit includes the tools that help to save time in automating web tests, such as the automatic generation of locators for web elements, conditional execution logic, built-in test reporting, and much more.
Set up and Run a Sample Test
=> To follow along with below walkthrough steps, download and install the free trial of Ranorex Webtestit.
You’ll set up a username and password that will also give you access to the Ranorex Webtestit user forum: https://discourse.webtestit.com/, which is a great place to get help or interact with the Ranorex team.
You should also add the free Ranorex Selocity browser extension to Google Chrome and this is incredibly useful for generating the UI element locators.
#1) Launch and sign in to Ranorex Webtestit. The Start screen will appear.
#2) Click Download sample project.
#3) Choose Java – Demoshop, and then click Download and open. This sample project is for a fictional web store, which you can find here: http://demoshop.webtestit.com/
#4) The Ranorex Webtestit project view opens. On the left, you will see the project window with the project tree.
In the project tree, you can find several Page Object files. Each one will represent a major section of a web page (not necessarily an entire web page). Using a Page Object model separates the definition of the UI from your test code, thereby making your tests easier to maintain and less likely to break.
If you’re unfamiliar with Page Objects, then you can learn about them here.
#5) In the below page objects, you can see two test cases, TC1 and TC2. The first test case adds items to a cart and then checks out. The second test case verifies the “fast checkout” process.
#6) In Ranorex Webtestit, you can notice the “Get Started” panel on the bottom left corner (if you don’t see it, you can open it from the menu. Just choose Help => Get Started).
As this is a demo project, steps 1-3 are already complete. To run the test, all that we need to do is add one or more endpoints.
#7) Open the Execution panel. Click Add Endpoint.
#8) Choose Local endpoint. Let’s name it “Local Chrome”. Set the Platform to Desktop, and choose the Google Chrome browser. Then, click on Save endpoint.
#9) The new endpoint appears in the Execution panel and you’re now ready to execute the test suite.
#10) Click Run all test files. As this is the first time you have run a test with Ranorex Webtestit, there may be several dependencies to load.
Future test executions won’t need to repeat this initial download and it will go faster. You can track the progress in the Log panel just below the Execution panel.
#11) Finally, the test run finishes. Now, Click on Show Report.
#12) The test run report shows the duration of the test, the number of test failures (if any), number of test suites and test cases executed, and much more. Click the down arrow next to the TestSuite(Desktop) item to see the duration of each of the test cases executed.
Start Building Your Own Web Test
So far you have seen a sample test execute on your desktop, let’s take a look at the process for building your own test.
#1) Click on New Project and the Create new project dialog will appear.
#2) Enter a project name, select your preferred programing language, and then click Save. If you select Java, Ranorex Webtestit “scaffolds” your project with Maven, Apache’s build automation tool, and the widely used TestNG testing framework. Then, the Project workspace appears.
#3) You may see a warning that Ranorex Webtestit is disconnected from Ranorex Selocity. Install the Ranorex Selocity add-on to the Chrome DevTools if you haven’t done so already.
Then, simply open the Chrome browser, right-click on any web element, and choose Inspect. In the DevTools panel, click Ranorex Selocity, and then click Connect.
#4) Return to Ranorex Webtestit. Click on New Page Object file. A file called “newpofile.java” will appear in the Project tree. Let’s rename this to “mainPO.java”.
#5) Now, open the Chrome browser and go to your web application. Right-click in the search box, and choose Selector actions.
You’ll see a list of available selectors for the search box web element. Just copy and paste the one that you want to use into your new Page Object file.
(If you link Ranorex Selocity with Ranorex Webtestit, then you will also have the option to send the selector directly to Ranorex Webtestit along with a screenshot).
#6) Return to Ranorex Webtestit, and you’ll see a new element in the Elements panel. If the name of the element isn’t meaningful, then you can edit it. In the example below, the name has been changed to “Searchbox.” Now click on Close.
#7) To use the new element in a test, first add it to your page object. Simply drag the element into the page object and choose an action, such as Click on element or Type into the element. Ranorex Webtestit will automatically create the associated code for you.
#8) Now you can start coding your test. Right-click on the tests folder in the Project panel, and then choose New => Test file. Ranorex Webtestit creates a new test file and includes the boilerplate code for you. You can call the actions in the Page Object to perform your test steps.
#9) Once your test is complete, add an endpoint as in the demoshop example above, and then execute your test.
The Fine Print:
Ranorex Webtestit works on Windows, Mac, and Linux. It integrates with tools like TFS, Jenkins, Jira, Git, TestRail, and TravisCI using the command line interface.
If you are using (or thinking about using) Selenium WebDriver, then you should definitely check out Ranorex Webtestit. It will, in turn, save your time upfront, by setting up your test project for you.
It will save your time with every web test that you build, through the automatic application of the Page Object model, reduction of boilerplate code, web element locator generation, and much more.
You can read more about Ranorex Webtestit here
Please feel free to share your experience in the comments section below!