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

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

16 Mar 2018
Author:Web Systems
226

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
Developing your own site: what’s the price?
Blog

Developing your own site: what’s the price?

How much does it cost order a site from developers? What factors depends on the price? What you should pay attention to developing the site - read about this in our new article.

Bit to bit IT: an interview with the developer about studying, first job and prospects
Company

Bit to bit IT: an interview with the developer about studying, first job and prospects

On Thursday, October 25th, the first event organized by the Khmelnytskyi IT cluster was held. Representatives of local IT companies, cluster members, met with the students to get them acquainted with web development trends and share their success stories. Our developer Vitalii talked about his way from a student to an in-demand expert. The day before we spoke to him for our blog.

A trading platform vs your website. What to choose for sales?
Blog

A trading platform vs your website. What to choose for sales?

On the Internet, you can find a huge number of articles on how to effectively sell through online sites and their advantages over individually designed websites. In this article, we will not argue, because many traders really successfully sell their goods on trading platforms. We will try to find out at what stage of the development entrepreneur's business requires his own website.