Test-Driven Development
August 10, 2020 - #software testing #coding #tdd
In this article, I will discuss Test-Driven Development and some common testing techniques.
This is my summary of this video for learning purposes, please check out the video to support the creator.
What is Test-Driven Development?
It's a software development technique that developers write test cases first before diving into the implementation.
The main purpose of this approach is to reduce bugs and make the software become more maintainable. Plus, writing test cases first will help developers understand the requirements better, which will increase their productivity.
Functional Testing
The main purpose of functional testing is for developers to test the actual code. Here are some of the main functional testing types.
-
Unit Testing
Validate the behavior of a specific module of code - function, method.
E.g., a unit test could be a test to check if the return value of a function, that calculates the sum of 2 numbers passed in the parameters, is correct. A popular way to write unit tests effectively is to follow the AAA approach (Arrange, Act, Assert).
-
Integration Testing
Test multiple units of code together.
E.g., we could use integration testing to check if the UI component could display the data fetched from the back-end correctly.
-
End-to-end Testing (E2E)
Run the app on a simulated environment and emulate the actual user's behavior to check if the app responds to a certain situation as expected.
E.g., we could use the e2e test to verify if errors show up when a user clicks submit button without entering any data on a form.
-
Acceptance Testing
Check if the application meets all of the client's requirements.
-
System Testing
Ensure that the application could work well on the actual server or hardware.
-
Smoke Test
Because there might be thousands of tests on the application, having smoke test will save us time running all the tests by executing some of the important tests only. This is useful for running tests for CI/CD purpose or doing a quick check for the current state of the app after applying changes.
Non-functional testing
The goal of non-functional tests is to check for non-functional aspects of the application (performance, usability, security, etc).
For more information on non-functional testing, this article is a great resource.