Can anyone please guide me on how one can perform cross browser automation testing by using watir.
Cross Browser Automation Testing Using Watir
Source - LambdaTest
We are living in an era where software development demands for automation. Software development methodologies such as RAD(Rapid Application Development), Agile and so on requires you to incorporate automation testing as a part of your release cycle. There exist numerous test automation frameworks used for automation testing.
Today, I will be picking up Watir an open source, selenium-based web driver used for browser automation. Cross browser automation testing using Watir would help you to ensure a good rendering user interface of your web app. If you are a beginner to automation testing and are unaware of basics then don’t worry as I will also be talking about browser automation, cross browser automation, parallel testing and what makes Watir special than other several tools and libraries. Without further ado, here we go!
What Is Browser Automation?
Browsers have become indispensable to our daily basis productivity. We explore, learn, shop, invest and do a lot more with browsers. There are times when we feel the need for browsers to automate our repetitive tasks. Imagine how cool that would be? Is it possible? Yes, any task you perform in browsers is automatable.
Let us take some considerations based on basic practical scenarios. You can use browser automation if:
- you need to fill a lot of forms for data entry.
- you need to generate a report from web portal on daily basis and send email to the team.
- you navigate to a specific website and upvote on daily basis for a particular candidate on a reality TV show.
In the software industry, testing a web app can demand for a huge investment of time, resources and money. Testing a web app to check how well it renders could be very strenuous if relied upon manual testing alone. The manual testing ensures your application is functioning as expected, based on client requirements and expectations. Browser automation comes to rescue so we could avoid repeated manual testing, regression test cases, and obtaining early feedbacks along with reduced effort.
What Is Cross Browser Automation Testing?
Now, there are thousands of browsers available on the internet and your website may render in a unique manner on every browser or browser version. It could be very complex to test your website across every single one of them. Cross browser automation testing is to verify your application renders seamlessly across different browsers and its combination version. This is primarily performed to check cross browser compatibility of your shippable application’s functionality on combinations of the various OS running separate browsers like Google Chrome, Mozilla Firefox, Edge, IE, Opera, Safari, Yandex and many more.
To run all browsers and its combination of version is time-consuming. For eg., your client asks to perform a regular basis cross browser compatibility check across 5 versions of latest and 5 versions of legacy Chrome, Safari, Firefox and Edge browser that would bring a total number of browser combinations to be of 40 completely different distinctive browsers and its version for one test case. Consider how overwhelmingly time-consuming and tedious it could be to perform a cross browser compatibility check over all those browser combinations and provide sign off, that needed positively proper planning, huge investments in QA resource, handling challenges, time and cost. To deal with this issue, Cross Browser automation testing for parallel test sessions is the solution.
What Is Cross Browser Parallel Test Automation?
Cross Browser Parallel testing is performed to run a single test across multiple browser combinations, simultaneously. This is a very practical and powerful consumption scenario of automation testing. Cross browser parallel test automation allows you to scale back execution time while not compromising with coverage of your check and leading to faster rotation of your test results.
What Is Watir?
Watir is an open source Ruby Libraries which helps to achieve cross browser automation testing. Watir supports Ruby which is object oriented language and typically it’s simpler and faster than other languages. The good thing about Watir is, it supports any web application irrespective of the technology used to develop that application.
- It’s a free open source tool belonging to a family of Ruby.
- It supports headless browser execution.
- It supports page object design pattern.
- It supports Cucumber Integration.
- Tests can be maintained simple and flexible.
- It supports your web app no matter what technology used to develop your app.
- It supports multiple browsers on different platforms.
- It is lightweight and easy to use.
- It supports execution in Cloud through cloud based cross browser automation testing tools like LambdaTest.
In this article, we will take a look on how to setup test automation environment for Watir with RubyMine IDE and then go ahead with the sample script. I would also show how to run the script and see the failure in RubyMine. Let’s dive right in.
Getting Started With Cross Browser Automation Testing Using Watir
Here are the prerequisite required for performing cross browser automation testing using Watir on Windows:
- RubyMine IDE
The RubyInstaller is must because Watir supports Ruby code, so this installation is very important before we proceed with Automation.
Setting Up Automation Environment
This section has detailed steps explaining how to setup automation environment for performing cross browser automation testing using Watir through Windows.
Step1: Installation of Ruby:
Navigate to Official Ruby Installer page here.
Click on Latest version With DEVKIT to download. Select your OS architecture type, for e.g., I select (X64) 64 bit operating system.
After download, right click on installer and run as administrator in Windows machine.
After installation is complete, the following window will popup to install updated component. This is optional either you can leave it by closing the window or hit “Enter” button to update all components.
Open command prompt in windows and enter the following command:
1. ruby -version
The installation version of Ruby version is displayed in the command prompt, which indicates Ruby installer is success.
To verify once again the installation is success and Ruby programs works fine. Enter the following commands:
irb or IRB stands for Interactive Ruby Shell which is a REPL(read-eval print loop) for programming in the object-oriented scripting language Ruby.
I will write a simple code that will put “lambdatest.com