Code:
Use Assertion as little as possible in a functional test,
In a test suite for users and roles you might have 2000 test cases, but you might have only 100 test that actually test creating a user and the rest of the tests will test other functionality above and beyond that. Those other tests will have will have pre-steps or setup that will add the users before the actual test.
- Create user (dependent functionality)
- Check property
- Login as user (dependent functionality)
- Check that user is logged in
- Change user name (functionality being tested)
- Check new user name
Code:
Now when you get an NUnit test report and the create user functionality is broken your report will say 1999 tests errored and 1 test failed. If you gave your tests meaningful names you'll know exactly what broke. Your test name might be AddAUserWithDefultPermissions()
Exceptions should also be raised in any helper classes any time there is a test run that has no failures and has errors you'll know you need to write at least one new test.
No comments:
Post a Comment