Using Nunit for Test-Driven Development

TDD
Test-Driven Development (TDD) is an approach to development which combines test and coding phases. It's one way to think through the requirements or design.

Steps to follow:
- Review the requirements.
- Write test-code for the requirements. (Ie writing test code that meet the requirements before )
- Write code to fulfill that test. (Ie: writing real code).

Nunit.
Nunit is a test framework for all .NET languages. It can run tests in assemblies written in managed code. It can be used to unit testing in assemblies. I usually use for testing exceptions, assertions.

Code:

The below code is my example for how it work.

Some notes:
- DemoTest Class is which will be tested.
-  Tester Class is which will implement testing DemoTest.
- [TestFixture] is class attribute  which is used for class testing
- [Test] is method attribute which testing method. It will be showed in Nunit.


Share on Google Plus

About Chien

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 comments:

Post a Comment