Everybody knows this situation. You implement a new feature and consequently you break two already existing ones. Then you fix those two and you break something else. This happens especially when the system becomes complex.

Of course, you can reduce this kind of problem a lot, by using proper solution architecture or by hiring only experienced senior programmers. However, we are all still only humans and we make mistakes.

There are many ways how to test a system, from a really narrow unit tests, to E2E (end-to-end) tests of the whole system. While unit tests are quite popular in the developer community, E2E are often underestimated. They are considered to be something only a tester should do. However, it is only a partial truth, a good E2E test can be a nice piece of code.

In our platform Tabidoo we use a protractor (by the way, Tabidoo is a tool for creating and running online database system). All of the “basic” actions are covered by special utils. These are later used for specific tests. Does it sound familiar? This is exactly what you do as a programmer. You have basic tools for reading files, access to data and then you use them in your procedures/components.

Tabidoo E2E test. The most boring video we have ever published.

So, in utils there can be functions to login, open edit form, fill the field and save.

login(userName: string, password: string) {    
    element(by.css('#userName input')).sendKeys(userName);  
    element(by.id('password')).sendKeys(password);    
    element(by.css('.login-panel .btn-signin')).click();
}editRecordMenuClick() {    
    const el = element(by.css('.grid-buttons-panel .btn-tbd-edit'));    
    this.pageCommon.waitForElementAndClick(el);
}

Pretty easy, is it not? There are a few functions and selectors you need to know and then you can start to create these utils.

And now let us move on to the main point. Specific test. That is just a story written in the language you created. Just use your utils like this (utils are called page here):

it('should login and edit a record', () => {    
    page.login('test-user', 'eet789d9fg564');    
    page.editRecordMenuClick();    
    page.fillInput('Name', 'Jack');    
    page.fillInput('Age', 25);    
    page.ClickSaveButton();    
    page.verifyRowValue(0, 'Name', 'Jack');    
    page.verifyRowValue(0, Age, 25);
});
There is no space for errors when you use Tabidoo.

That is it. Anybody can do it. Nevertheless, only very few projects have robust E2E tests. Even these tests run very quickly, at the moment it takes over two hours to go through the basic functionality of Tabidoo. This is yet another benefit of using it to create applications.