Unit Testing your Team Project

You've been asked to allocate 5 story points per person for testing during Sprint 3. Here are the requirements. As usual, you'll need to figure out how to get your entire team to do this in coordinated fashion.

Requirements

  • Add a single new project to your Visual Studio solution. Make sure it has "test" in the name. Each team member will place their tests inside this project.
  • Use NUnit, not MSTest.
  • Each developer should find one tiny piece of functionality within a Controller, Model or ViewModel class. Ideally this will be a single simple method (not a single action method). If it isn't, refactor some functionality into a single helper method. You'll test only this method. There should be no dependencies.
  • Write comprehensive NUnit tests for this functionality in a new test class in your test project. Create a separate test class for each developer. Name it appropriately with what you're testing. Add a comment at the top of the file that lists the User Story ID that you're working on so we can trace tests to requirements.

    Even a simple method (like our capitalize method) will require multiple tests. You'll be surprised.

  • Let's try to use a common naming scheme for our unit test methods. Name each test method with the following syntax: [Feature, functionality or unit of work under test]_[Behavior, with a verb in there, i.e. "should" or "shouldn't" or returns]_[Expected result]. For example:
    • IsValidFileName_NameShorterThan6CharsButSupportedExtensionReturns_False()
    • Route_ContactPlusAnythingShouldMapTo_HomeContact()
    • ConfirmDate_DatesBeforeTodayShould_Fail()
  • Make sure all tests pass. During the sprint review meeting you should be ready to "Run All Tests" and show an all-green board.