QA Analysts often utilize technology to minimize the amount of manual work we do when testing software. More and more people are interested in using automation testing in their projects to save time and money during the development lifecycle. However, creating a test automation framework from scratch is often time-consuming and requires some trial and error. Over time, we’ve developed a framework that we use as a template for new projects that saves a lot of time and headaches up front. But before we get too ahead of ourselves, let’s refresh a little bit on some of the basics of automation testing.
What is Automation Testing?
Test automation software tests your project’s code by running scripts. It allows you to repeatedly execute scenarios over and over again without wasting time doing them manually. Automated tests allow development teams to release more frequently without minimizing the testing scope while still achieving high-quality work. In order to accomplish that, there are numerous automation tools that can be used. One such tool that we frequently turn to is Selenium.
Common Weaknesses in Login Pages
A login page is usually enough to stop cyber security risks. They’re still vulnerable to attacks though, so we need to ensure they can’t be bypassed or tricked in any way.
What is Selenium?
Selenium is one of the most commonly used tools for automation testing. It automates browsers and has two main components: Selenium Webdriver and Selenium IDE. Both are suitable for different purposes but today, we’ll focus on the Webdriver functionalities.
The benefit of using Selenium Webdriver is that it has implementation for commonly used actions like clicking on buttons, adding text in text fields, accessing page information (i.e. titles), entered text, and many more.
After several years of using Selenium on various projects, we realized the most common issues we face, which code often gets repeated, and our most common setups. Taking all that into account, we created a framework wrapped around Selenium, so that we don’t repeat mistakes from previous projects. This saves time for the clients by having all the initial setup out of the box. In this way, we can do more tests in less time, have higher coverage, better reports for clients, and, most importantly, reduce the automation test flakiness.
To brush up on some of the other automation tools available, read our in-depth comparison on the matter.
MentorMate Test Automation Framework
Why do we use a framework?
We found that the initial setup on various projects took way too much time. At the end of the day, they all had to go through similar issues. We resolved this by creating a framework to use as a template for every new project, offering us the leverage to avoid all of the known problems.
When automated tests are created, the first thing we do is interact with the browser in some way. This can include navigating to a page, clicking a button, or filling in a login form. After that, we need to verify and report the actual vs. the expected result. While we have many different tests at our disposal, how and when we use them is dependant on the scenario. In some cases, we’ll execute several tests in a specified order. In others, we’ll only execute specific tests. In order to achieve all of this, testers usually need to implement different frameworks or libraries along with the Selenium Webdriver.
Most projects have common user actions that need to be accomplished in an automated test. These include things like choosing an option from a drop-down, selecting checkboxes, switching tabs and windows, etc. All of these are already implemented in the framework itself and the QAs can use them right away without wasting time to write them themselves. Another advantage is that we can easily read data from files. For example, we can have a list with username and password credentials which we want to use when we run the tests. With the framework, there is no need to waste time developing this functionality since it is already done.
Along with all positives, the framework is integrated with the TestNG testing framework. This gives us the flexibility to easily choose which tests we want to run: a whole test suite, only the so-called smoke tests, and so on. It supports data-driven testing and flexible test configuration.
The framework is implemented currently in Java and C#. It allows us to easily switch browsers when testing without the need to worry about downloading additional drivers for them. We can use it with BrowserStack and Sauce Labs accounts, giving us access to numerous browser configurations. No matter if the project is short-term (a couple of months) or long-term (1+ year), the framework is suitable for both.
The Mentormate Framework can be used to speed up the automation building process starting from scratch or to enhance existing automated tests.
Another great advantage is the integrated Allure Reports. One of the most important parts of automation testing is having a visual representation of the results. It gives us different charts with passed and failed cases, the duration of the test run, and, most importantly, self-documented tests. This means we can see exactly on which step the test failed, as well as the reason and a screenshot of the moment it failed. The results are clear for everyone on the team which saves a lot of time than if we needed to create them manually.
Since we are using scripts in the automated tests there are two main reasons why a test can fail:
- There is a discrepancy between the actual vs. the expected result which usually means that there is a product defect. Those tests are marked as Failed
- The test itself is broken due to a bug in the script for example. Those tests are marked as Broken
This helps us to determine whether there is an actual issue with the software that is being tested or we need to make some improvements in the testing scripts.
Top Benefits of the MentorMate Framework:
- It has an implementation of Browser Factory. This means we don’t need to implement all the various browser-related code.
- Capability Factory — we can pass additional capabilities to the browsers without writing additional code. Simply pass the key-value capability to the browser with browser.json
- Passing the automation using a proxy can be achieved with a simple switch from the TestNG.xml file.
- Headless browser is supported with a switch from the TestNG file.
- Cloud testing support — BrowserStack and SauceLab are enabled without writing additional code, simply pass the user and pass in Browser.json
- Three types of reports — Allure, ExtentReports, and ReportNG — can be enabled or disabled without additional code
- Additional features for working with XML, CSV, and Word documents
- BDD enabled with Cucumber framework
In summary, if you’re planning on adding automated tests into your project, consider using an already-developed framework like the MentorMate one. This way, the test writing could be sped up and the development team won’t waste too much time building a skeleton from scratch. Take advantage and make your automation easier, faster, and more efficient.