Unit Testing with MSTest
Unit Testing with MSTest: Unit Testing: an overview, The MSTest Framework, Planning Unit Tests, Adding Test Classes, Writing Tests, Test-Driven Development.
Updated
- Unit Testing: an overview (Novice): What a unit test is, and why small classes with clear responsibilities can be tested on their own.
- The MSTest Framework (Apprentice): MSTest is Microsoft's testing framework for .NET. A test runner finds and runs your tests; a test class holds the tests for one class, in a test project of its own.
- Planning Unit Tests (Apprentice): Plan tests from the requirements, as a table of scenarios. Each scenario changes one thing, and the edges (at a limit, just inside it, just past it) find the most bugs.
- Adding Test Classes (Apprentice): Add an MSTest test project beside your app, give it a reference to the app, and add a test class for each class you test.
- Writing Tests (Apprentice): Name each test for its scenario, write it in three parts (Arrange, Act, Assert), check results with MSTest's Assert methods, and run one test for many inputs with DataRow.
- Test-Driven Development (Apprentice): In test-driven development you write a failing test first, then just enough code to pass it, then tidy up. Follow three short cycles that build a shipping calculator.