Quality assurance (QA)
Quality assurance (QA) covers all measures that make sure software does what it should: automatic tests, code reviews, a definition of done, and checks in the build pipeline, not just an acceptance at the end.
Quality assurance (QA) covers all measures that make sure software does what it should: automatic tests, code reviews, shared rules for "done", and checks in the build pipeline. It is part of development, not an acceptance at the end.
The means in everyday .NET work
Microsoft describes three kinds of tests for .NET:
- Unit tests check individual components or methods, without a database, a file system, or a network. They run in milliseconds.
- Integration tests check whether several components work together, often including infrastructure.
- Load tests check whether a system can handle a certain load, such as many users at the same time.
A unit test usually follows the pattern arrange, act, assert: prepare the objects, call the method, check the result.
[Fact]
public void Add_EmptyString_ReturnsZero()
{
var calculator = new StringCalculator();
var actual = calculator.Add("");
Assert.Equal(0, actual);
}
The benefit is stated in Microsoft's guide: unit tests replace laborious manual functional checks, protect against regressions, serve as executable documentation, and lead to less tightly coupled code. The guide calls a good test fast, isolated, repeatable, self-checking, and timely.
People and rules belong to QA as well: the code review before merging, a definition of done that asks every change the same questions, and the automatic check in the pipeline (continuous integration). With test-driven development, the test comes before the code.
Read numbers with care
High test coverage is no proof of good quality. It only measures how much code the tests touch. The .NET documentation warns against setting too ambitious a coverage goal, because the last bit costs a lot of effort for little benefit. Nor is the word "Passed" in a test output everything: check the exit code of dotnet test, because it decides whether a pipeline turns red or green.
An example from the Kladde
In K1, the Kladde, the sample application of a small IT office, gets its first test project with xUnit and learns to tell from the exit code whether all tests passed. In the web version, integration tests with WebApplicationFactory check the API's routes and answers, a browser test with Playwright checks the appointment booking, and every pull request runs all tests.
How it differs
- QA and testing: Testing is one means, QA the whole frame.
- QA and fixing errors: QA is meant to find errors early. Fixing a bug that was found is the consequence.
- QA and the unit test: A unit test covers only a small part. It does not see registration, configuration, and how the parts work together.
In the course
You learn this in K1, module 1.8, in the lessons Why tests and Test-driven development. The kinds of tests on the web follow in K2, module 2.7, in Which test for what, and the team's set of rules in module 2.10 in Issues and definition of done.
Further reading on the blog
- Software tests: types and how to use them in a project
- Code review: benefits and process in a project
Sources
- Microsoft Learn, Testing in .NET: https://learn.microsoft.com/dotnet/core/testing/
- Microsoft Learn, Unit testing best practices for .NET: https://learn.microsoft.com/dotnet/core/testing/unit-testing-best-practices