Tests are a way to make sure the software is working as intended, bug-free, without security vulnerabilities and to know its limits.
They also serve as documentation on how to use the code
- Functional test: Checks that the software works that way it is supposed to.
- Unit test: Verifies small units of code such as a single methods or functions
- Integration test: Verifies modules or classes interact with each other as supposed to
- Benchmarks: Test the performance of the software
- Fuzzing: Send random inputs to the software to hopefully find a mysterious bug.
- Security test: Look for vulnerabilities in the software
Tests should be:
- Independent of the environment (except library dependencies)
- Fast
- Parallelizable
- Executed frequently
Most tests should be read-only regarding the OS environment file system.
If writes are necessary, they should be done in a temporary directory that is cleaned up upon test completion or interruption.
If the written files or directories remains, they should not break the next tests execution.
Next: Security