Types of Software Tests

Adam King
The Startup
Published in
4 min readNov 3, 2020

--

Photo by Scott Graham on Unsplash

TL;DR: A brief discussion about unit, integration, and end-to-end tests for computer applications

In this post I will talk about the different types of tests commonly used in the software engineering world. Testing your applications is a skill that has become highly sought after in the development realm. Many companies operate from a Test Driven Development (TDD) standard, which means tests are written first, and then code is written that will pass those tests. TDD is a subject that could take up it’s own blog post, so for today I’ll focus on the specific types of tests someone will encounter.

Unit Tests

When building software applications there may be times you want to make sure a particular function is working correctly. Maybe you want to verify it’s creating the right object or returning the correct information. This is where unit tests come into play.

Unit tests refer to testing a very specific part of your application on it’s own, to make sure it’s producing the correct output. Usually this entails isolating the function and making sure it runs well on it’s own. When you are writing unit tests you can think of it as zooming in to one part of the program to make sure it’s working as expected.

Example of a unit test with Jasmine Framework

The above picture shows a quick example of a small test with the Jasmine framework. This is a very simple implementation that specifically tests the function named sumPaymentTotal.

With every test mentioned in this post there are numerous programs to help you accomplish your task. Due to primarily working with JS and Python most of my examples will be of these languages and testing frameworks that work with them. But a simple google search will provide you a ton of recommendations for whatever language you’re using.

Integration Tests

The next type of test I will talk about is integration tests. Take a second to think about what the word integration means, and you’ll have a good idea of the goal of these types of tests. Integrations tests are used when you want to see how different parts of your application are working together, hence the integration part.

Usually this type of test is used to make sure your functions are correctly interacting with an API or a database. One thing to keep in mind when writing these types of tests is that you want to make sure you are still testing YOUR application. It can be really easy to write a test that actually tests the info you’re getting from an API or database.

This means if your just displaying information, then make sure you are testing that the information is displayed the way you want it to be. An alternative is if you’re taking the info and making your own data structure with it, you want to test your structure and not the information included in it.

More complex integration test written with python

The above test is taken from my first capstone project. As you can see it’s a little more complex than the first one. This is an integration test because we are making a request to to an API and verifying the information displayed as a result.

End-to-End Testing

Finally the last type of test I will talk about is end to end tests. These refer to tests that test the entire application. These are usually described as testing the flow of the application. The cool thing about end-to-end tests is that they are done from the users point of view. This means things are being tested as though someone was going through your application and interacting with everything you have built.

The common types of tests in end-to-end would be things like making sure a button shows the correct information after it’s clicked on. Some other examples would be making sure certain information is on a page, or that a page is loaded after navigating away from a previous page.

These tests are great because they zoom all the way out and test your entire application, instead of just a specific part. Unfortunately I have not created an end-to-end test for an app yet, but I do plan on looking in to them very. I look forward to updating this post with an example when I do.

These are the most common types of tests you will either write, or come into contact with, as you gain more experience writing code and building things. I would highly recommend writing tests for any applications you have written. They are a great way to make sure things are working correctly and can save you a TON of time when it comes to debugging.

Naturally, just like there are numerous languages to program in, there are a lot of frameworks for testing. My advice would be to pick one and play around with it. Don’t try to get a little bit of experience with all of them. If you’re newer to software development like I am, it’s much easier to find one you like and stick with it. It’s a great skill to showcase and will come in handy when you start applying for jobs!

--

--

Adam King
The Startup

Software engineer sharing stories of my experiences in a coding bootcamp and beyond.