Presentation is loading. Please wait.

Presentation is loading. Please wait.

NUNIT - Testing your Application. NUnit Tool – Used for Test driven development Lets create a sample banking class named account which supports operations.

Similar presentations


Presentation on theme: "NUNIT - Testing your Application. NUnit Tool – Used for Test driven development Lets create a sample banking class named account which supports operations."— Presentation transcript:

1 NUNIT - Testing your Application

2 NUnit Tool – Used for Test driven development Lets create a sample banking class named account which supports operations to deposit, withdraw or transfer funds. To get started, lets create a new project, and select project type as Visual C# - Class Library Also give the location as C:\Documents and Settings\smktb\My Documents\Visual Studio 2005\Projects -- with your respective username and give the name to the Class Library as TestNUnit

3 New Class Library

4 Rename the class name to Account.cs from Class1.cs

5 Add NUnit Reference by selecting your project name, right click and add reference as shown below

6 Add a new class “TestAccount.cs” and add the below code. Also add the namespace “using NUnit.Framework” and then build the solution

7 Start NUnit GUI from Programs-Applications-NUnit-Net-2.0 – NUnit GUI. Click on File-Open-Select the folder where your program is stored, go to the bin directory and select TestNUnit.dll

8 Click on Run to check the output. In this case, the test case will fail, as we did not invoke destination.Deposit(amount).

9 In order to correct the error, lets uncomment the line in Account.cs file which says “destination.Deposit(amount)”. Important points to note is that [TestFxture] denotes that the corresponding class contains a “Test Case” and [Test] indicates that the corresponding function is a test case


Download ppt "NUNIT - Testing your Application. NUnit Tool – Used for Test driven development Lets create a sample banking class named account which supports operations."

Similar presentations


Ads by Google