Unit Testing
Unit testing checks one small, observable behavior automatically, with the code and its dependencies controlled so failures point to a clear rule. It gives you fast feedback before broader integration tests exercise real systems.
itSoftware engineering | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Intro
Unit Testing
Unit testing is an automated check of one small behavior. You set up a known condition, invoke that behavior, and let an assertion decide whether the observed result matches the contract. The goal is evidence you can run repeatedly while changing code.
A useful unit test is fast, isolated, repeatable, and self-checking. Keep real infrastructure outside its boundary. A database, filesystem, network, clock, or random source can make a test slower or nondeterministic. Test that boundary separately when the boundary itself is the risk.
Start with behavior
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices
Supports
- Unit tests can be fast, isolated, repeatable, self-checking, and timely
- Unit tests should avoid infrastructure dependencies such as databases and filesystems
- Arrange, Act, Assert separates setup, execution, and expected result
- Tests should focus on observable public behavior rather than private implementation
- Coverage does not by itself establish code quality
- Controlling static time dependencies makes tests repeatable
- https://docs.junit.org/current/user-guide/
Supports
- JUnit is a current framework reference for test methods, assertions, parameterized tests, lifecycle, and execution
- https://learn.microsoft.com/en-us/dotnet/core/testing/
Supports
- The .NET testing overview connects test concepts with a platform and frameworks
- https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-code-coverage
Supports
- Code coverage measures code exercised by tests and requires interpretation alongside test quality
- https://github.com/TheJambo/awesome-testing
Supports
- The curated list identifies WireMock as an open-source HTTP mock engine
- The curated list identifies Bruno as an open-source API client for exploring and testing APIs
