Automated Testing in a Large-Scale Project: why and how we test our software – Web-systems

Automated Testing in a Large-Scale Project: why and how we test our software

16 Mar 2018
Author:Web Systems

The code should always work correctly. This is the main rule of the developer. When you work in a large team where each part of the overall project is delivered separately by different devs, it is important to ensure coherent teamwork. That is why we write automated tests. The goal of the automated testing is to ensure the quality of the product, as well as to protect your code from getting broken. In this article, Front-end developer Vitaliy tells us about the autotesting on one of his projects.

Vitaliy, Front-end developer at Web-Systems Solutions

Automated testing has many advantages, especially when it comes to implementing automated tests on the large projects. They work faster than a human. Automated testing can be performed at night and even on the weekends as it doesn’t require human control. Error notifications will be sent automatically anyway. Automated tests are accurate. The successful automated testing means you can trust the code. Moreover, they will not let your colleagues accidentally break your code.

In order to give you more specific details about the automated testing, I'll talk about one of our web projects where we’re writing such tests. First, let's talk about testing itself on the project I'll call it project A due to the legal reasons here. And then I’ll explain how we integrated the automated testing in Continuous Integration (CI)."

How we run automated testing on the project

We're using Behat framework to autotest the project. This library is designed for Behavior driving development or BDD. The essence of the ideology of BDD is that the scripts that are written in a human-readable language, not necessarily in English, called Gherkin are translated into tests which are based on the BDD framework, in this case, on Behat framework. The goal of the Gherkin syntax is to allow non-technical specialists to provide the clear requirements for the product.

Given-when-and-then script is used to describe each test case scenario. This is done for better understanding of how the system should work. We can ask the client to fill in the scenario, so we can go through the script and see how the product should work from his or her perspective. Let's say we do the website authorization, and we need to write an automated test case of the form validation. The script for this test will be:

Feature: Sign up
Scenario: Check validation
Given I am on the sign-up page
When I fill in the E-mail field
And I do not fill in the Password field
Then I see an indicator of validation error

In fact, testing helps us simulate user interaction with a future web product and localize errors if there are any. The Behat framework handles the scripts written in the human-readable language. It reads the text and looks for matching keywords in certain files. When it finds a test case, it runs the code through the automated testing. The programmer, in turn, uses this framework to write a program code that will perform these tests.

How the automated tests are integrated with Continuous Integration

Автотестування великих веб-проектів: для чого і як ми пишемо автотести: image-1What are the continuous integration tools and what do we need them for? There are many continuous integration tools. We use the one called Circleci on the project A. We use this program to track the source code. All the project changes are uploaded to the git repository. When changes get to the repo, the program builds them and runs through the tests automatically. If the error occurs, it notifies us about it. First of all, the program warns the developer who was the last to made changes to the code. He receives an email with the information on where the error occurred and what caused it, so he can fix the mistake immediately. Such changes will not get on the production server. If the automated testing is successful, it will send the changes to the server.

Autotesting is a good solution for large projects, because, first, it speeds up the process of testing and fixing errors in the code, and, secondly, it helps to automate some work of the developers and manage the actions of the team. We don’t cover with tests the entire project. A large project can have thousands of different test scenarios. It's natural that you can not automate all of them. And there are some moments that it’s just better to check manually. Actually, manual and autotesting complement each other. And if you use both, you can be sure that you will get a high-quality product as a result.

Would you like to order the project?
Call us +38 067 98 00 900
or fill the form

Start the project
Color Psychology And Modern Commerce: Experience of the Successful Brands

Color Psychology And Modern Commerce: Experience of the Successful Brands

Сolor plays a very important role in marketing, design and promotion. Study has found that colour alone can increase brand recognition by up to 80%! In this article, we will analyze the main colors used by famous brands. We will talk about the meaning of each of them in different areas of modern commerce as well as about what should be taken into account when choosing your corporate color and developing your own brand.

«The silver developer» of online stores in Ukraine!

«The silver developer» of online stores in Ukraine!

Almost 500 web studios from all over Ukraine presented their works to the experts and users. Today are determined three winners of 2016. WEB-SYSTEMS SOLUTIONS team took second place and received a silver crown online stores developers on CMS OpenCart. How we were striving for victory - read the article!

5 alternatives to the white background or how to take the pictures of the goods to make them desirable

5 alternatives to the white background or how to take the pictures of the goods to make them desirable

Do you want to sell via the Internet more? Properly selected web site design and quality photos will help to underline all the features of the goods. In this article, we will consider 5 alternatives to the white background for photos of goods, which will help to stand out and attract the attention of buyers exactly to your product.