80 likes | 298 Views
Test-Driven Development (TDD). In Traditional Software Development. 1. Write Program First. 2. Create a UI. 3. Test it Later. Developer. In Test-Driven Development. 1. Test First. 2. Write Later. Developer. TDD Cycle. Tools. Nunit for .NET JUnit for Java
E N D
In Traditional Software Development 1. Write Program First 2. Create a UI 3. Test it Later Developer
In Test-Driven Development 1. Test First 2. Write Later Developer
Tools • Nunit for .NET • JUnit for Java • MS Test for Visual Studio 2008 • And many more…
Sample Code in NUnit Code being tested Unit Test using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; using MyApp.DAL; namespace MyApp.Test { [TestFixture] public class MyTestClass { [Test] public void AddTest() { Class1 myClass = new Class1(); int result = myClass.Add(1, 1); Assert.AreEqual(result,1); } } } using System; using System.Collections.Generic; using System.Text; using MyApp.DAL; namespace MyApp.DAL { public class Class1 { public int Add(int x, int y) { return x + y; } } }
Nunit Application • GUI Application indicates that code was Failed