Automation testing using Selenium

 In Blog
Automation,
What is the first thought that comes to our minds when we hear the term automation? Loss of jobs, Unemployment, Robots are going to control the world and a lot more of our vivid scientific movie imaginations. Before moving into the topic, let me narrate a small story, During the 1950s, there was a job which was popular all over the developed countries.

Every office, every law firm would have hundreds of people working on this position. An entire floor would also be dedicated to the people in this position. It was a good-paying job too. Their jobs revolved around stacks and stacks of paper and loads of ink and pens. Then one day, a machine was invented which would make the people working jobless overnight.
Can you guess the machine and the job which became redundant?
The job was copy-writing and the machine which automated their job was Xerox machine. What copywriters took days to make copies of important documents, policies and other similar documents, the Xerox machine took minutes to complete the same job. Xerox machine automated the job of copying. Now, when we look back will we say that no the invention of the Xerox machine was wrong and humans must be again working in the copy-writing jobs. The answer is a big NO. The word that synonyms with automation is evolution.
Automation is everywhere and it is a part of evolution. So, next time when you hear the automation the first thing that should come to your mind is evolution. The jobs which are lost due to automation will evolve into different streams which will push mankind to achieve greater things.
Now, let us see how automation helps in testing. Take WhatsApp for example, Initially when Whatsapp was released it had only one feature that is to send and receive messages. After developing the feature the development team would have handed over the build to the testing team. The testing team would have tested and raised bugs and retested them. Once, the build was stable, the application would be released and we started using it. Now, a new feature of sending images and videos was implemented. Now the testing team has to test the new feature as well as the old feature of sending and receiving messages. Then a new feature called Groups was implemented. Now again the testing team will test the new feature as well as the old features. Then privacy features, bulk send, status, and so many features were introduced one after another. Now, the same testing team will test the new features and would only randomly check the old features. Why? Why would the testing team instead of testing the entire application again only tests random previous functionalities? The reason is humans, in general, are lazy. As, testing the entire application, again and again, is mundane and tiresome. This would lead to failure of the application if some of the previously implemented functions are not working.
This is where automation testing comes to the rescue. With automation testing, we can automate all the regression testing part i.e, the testing of older functionalities. The most popular tool in the field of automation testing is Selenium.
Selenium is popular because it is open source and has wide community support. How does Selenium work? Selenium is a library that replicates all the human interactions in a browser. And, yes it can only test applications that run on a web browser. What do we do when interacting with an application or software. We identify the specific target and perform some action on it. We identify a target/element visually by looking. Likewise, selenium identifies an element in a web browser via locators. Think of locators as identifiers. How do we identify a person? By name, gender, country, etc. Likewise, each element you see on a web page has an identity to it like id, name, xpath, etc. With the help of these locators, selenium identifies an element on a web page. After identifying an element selenium provides us with a variety of functions to perform some actions on the element just the way we do. Those actions include opening a website, giving inputs such as texts and images, clicking on a button and so on. With the help of automation, all the testing scenarios can be automated and every time a new feature or a build is released the automation script can be run be detect any bugs in the existing features. Automation testing saves a lot of time, manpower and helps in faster deployment of new features.
The latest fad in the testing community is Visual regression testing. With the help of Selenium, only the functional part of the application can be automated. But all applications are comprised of both functional and visual elements. Visual regression testing tests the Spacing, color, position of the elements on a web page and so on. A minute change in the position of an element will not be identifiable by a human eye. But, with the help of Visual regression testing, a small pixel change can be identified and fixed. It works by comparing a base image with the screen under test. The first time it runs, it takes the screenshot of the application screen and for subsequent runs, it will compare the application screen and base screen and lists out the differences. Thus automation helps in functional testing and visual testing of an application making the application error-free and increases the efficiency of the software.
Recent Posts

Leave a Comment

Start typing and press Enter to search