How to get a better and more secure code with automated testing

Code failures can cause headaches for developers, customers and end users alike. But there are effective ways to guard against them. We explain what automated testing is and why your project deserves it.

Marcin Zajadło
Development

Manual testing and automatic testing

There are two types of tests: manual and automatic. Manual testing is something all developers do on a regular basis. Did what I just did work? We tweak a little and test again: Does it still work?

“Automatic testing is the same test, only that it is the machine itself that performs them. These tests are triggered when we make changes. This means that we test the code not only when we add or remove something, but with every little adjustment,” says Marcin Zajadło, developer at Increo.

A safety net

Let's say we're working on a webpage. When we make a change to the code, we push this to the server, which in turn runs the test. If everything works as it should, the code pushes on to the web page. If not, that process stops and lets us know that something is wrong.

That ultimately means that the code we're pushing is more secure. In larger projects we can have over 100 tests running. It is impossible to do manually. Should we miss something fundamental in such a project, we still do not run the risk of pushing the wrong code. You could say it's a safety net.

Of course, there is no need for automated testing in everyone projects.

It all depends on the size. In smaller projects, there may not be a budget or time, and usually not necessary either. But in projects of a certain size, this is an investment that pays off, explains Marcin.

Ensures continuity

Automated testing is also a quality assurance for projects that run over a long period of time. If a project spans several years, it can happen that some people get sick or quit — and others have to step in.

“Developers can't know everything that's been going on in every project. If they go on over time, it will be hard to remember even if you have been there from the start. It is simply impossible to keep track of everything that can go wrong. Automatic testing keeps human fallibility in check, as well as saving the developer both stress and time.

Marcin also adds that the tests also serve as documentation. Should a lead developer quit, other developers can jump in and check the test script.

“Then they immediately see which functions require which parameters, and that ensures the continuity of development. Manual testing would be more time consuming, and therefore also more expensive in the long run. So if you know the project is going to run for a while, then automatic testing will pay off,” he says, concluding:

These tests are a bit like SEO. It's hard to sell because you can't “see” them. But that doesn't mean it's unimportant. Would you buy an untested car?

What can we help you with?

Sebastian Krohn
Sebastian Krohn
Agency Manager, Consulting
Oslo
sebastian@increo.no
/
988 00 306
Morten M Wikstrøm
Morten M Wikstrøm
CEO, Consulting
Trondheim
morten@increo.no
/
976 90 017

See also:

Keep up to date with our newsletter