Introduction
xUnit.net is a testing framework which is simple to use for .net developers. It comes with a testing framework library and Test runners for .net 2.0 and 4.0.
Implementation
- Download the xUnit.net framework from here and install it.
- Add a Visual Studio Class Library Project and name it as Calculate.Test
- Add reference to the Project that need to test.
- Add reference to xUnit dll. The solution structure will looks like this.
- Open CalculateTest.cs file write a test method for Add method in the Calculate Project.
Let’s try for a fail case
- Open xUnit.net Test Runner application from installation folder
- Select Open from Assembly menu and add the test dll i.e Calculate.Test.dll which will be displayed in xUnit.net Test Runner as shown below
- Click the Run All button to execute the test methods and the results will be displayed as shown below.
-
Modify the test case as shown below to fix the test case
- Run the test will give the green signal.
Conclusion
xUnit.net is a easy to use framework for .net developers.
Thanks,
Bimal
No comments:
Post a Comment