SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
An Introduction to Unit Test
       Using NUnit
           Wei Li
           08/2007
Test, Test and More Test
•   Developer Test
      o   Unit Test
      o   Integration Test
      o   Regression Test

•   QA Test
      o   Integration Test
      o   Regression Test
      o   Performance Test
      o   Stress Test

•   Customer/User Test
      o   Acceptability Test
      o   Useability Test
What Is Unit Test
• Self checking or validation to ensure your
  code works as expected

• Developer’s test

• Part of the construction cycle
Where Does Unit Test
           Sit In Life Cycle
• Requirement Gathering
• Business System Design
• Technical Design
   o Architecture Design
   o Technical System Design
• Construction
   o Code and Unit Test
• QA Test
• User Test
Unit Test Is Not
• QA test

• Customer/user test
Why Unit Test
• What? Write code to test code?

• Why?
Instant Feedback
• Unit test provides the earliest opportunity to
  identify and fix a defect
• The earlier a defect is caught, the less
  expensive it is to fix it
• Done before integration
• Like a dedicated QA/user sits next to you
  and test your code immediately
Help Design And Write Better
             Code
• If your code is hard to be unit tested, how
  can it be easily used, maintained and
  extended?
Regression Checker
• When new release of the external dependency
  comes, you can quickly run the unit tests to make
  certain the new release won’t break your system

• Automatic change detector
   – When changes are made to the code, automated unit
     tests ensure that the change does not break something
     somewhere
Good Way To Work On Legacy
           Code
• Write unit test to get started with legacy
  code
Good Way To Learn New
      Language and New API
• Write unit test cases to learn and try new
  API

• Your unit test cases become reusable
  knowledge base
Good For Reporting a Defect
• Write a test case to report a defect or bug in
  a system

• When something fails, writing a unit test for
  that failure guarantees that it's fixed for
  once and for all.
Save Time In Long Term
• Unit test is reusable and repeatable

• Unit test can be automated

• Write once run forever
There Is More Than One Way To
             Do It
• Main() method with lots of print out

• GUI “push that button” test

• Debugger test
Problems With The Above
              Methods
•   Is the test well structured?
•   Can it be automated?
•   Is the test repeatable?
•   Does it need human interaction?
•   Is it easy to be maintained ?
•   How to present test results?
Stop Debugger Test
• Debugger time is not recyclable

• Debugger session is not reusable by others

• Not a regression testing tool

• Mental assertion is error-prone and boring
Enter NUnit
• A unit test framework written in C#
• It uses attributes to identify unit test fixtures
• It uses assertions for verification
• It can be used to test any .NET code, not
  just C#
• It provides a console and GUI interface
• It can be integrated into VS.NET
How Does NUnit Test Code Look
            Like?
• Show me the code
NUnit Attributes
• Custom attribute injects more information
  to your class at compilation time

• NUnit uses it to mark and identify unit test
  fixture
NUnit Required Attributes
– [TestFixture]
   • Used to indicate that a class contains test methods


– [Test]
   • Used to indicate that a method within a test fixture
     should be run by the Test Runner application


Example: Test1.cs
NUnit Optional Attributes
– [SetUp]
   • Used to indicate a setup method should be ran before each of
     the tests

– [TearDown]
   • Used to indicate a tear down method should be ran after each
     of the tests are ran

Example: Test2.cs
NUnit Optional Attributes
– [TestFixtureSetUp]
    • Used to indicate a setup method that will be ran once; before
      all other tests. This is the first method that is called before the
      tests are started.

– [TestFixtureTearDown]
   • Used to indicate a tear down method that will be ran once;
     after all other tests have run. This is the last method that is
     called after all the tests have finished.


Example: Test3.cs
NUnit Optional Attributes
– [ExpectedException(typeof(Exception))]
    • When you want an exception to be thrown
    • Will only pass if exception type was thrown

– [Ignore(“Not ready yet")]

Example: Test4.cs
NUnit Assertion
• It is all unit test cares about

• NUnit provides a full set of assertions ready
  to be used

• Assertion failure means test failure
NUnit Assertion
•   Equality Asserts
•   Identity Asserts
•   Comparison Asserts
•   Type Asserts
•   Condition tests
•   Utility methods
NUnit Equal Assertion
• Assert.AreEqual(expected, real_value)
• Assert.AreEqual(expected, real_value,
  “a message”)

• Assert.AreNotEqual(expected, real_value)
• Assert.AreNotEqual(expected, real_value,
  “a message”)
NUnit Identity Assertion
• Assert.AreSame(expected, real_value)
• Assert.AreSame (expected, real_value,
  “a message”)

• Assert.AreNotSame (expected, real_value)
• Assert.AreNotSame (expected, real_value,
  “a message”)
NUnit Condition Assertion
•   Assert.IsTrue()
•   Assert.IsFalse()
•   Assert.IsNull()
•   Assert.IsNotNull()
•   Assert.IsEmpty()
•   Assert.IsNotEmpty()
Examples
Show me the code
Test Driven/Test First
               Development
•   Write a unit test case for a new functionality
•   Run the unit test and it will fail
•   Write just enough code to make the test pass
•   Run the unit test again and it passes
•   Refactory the code to make it better
•   Repeat the unit test
•   Repeat the cycle
Continuous Integration
• Get the latest version of the project from source
  control system
• Build/compile the code
• Run all unit test cases
• Publish the build and test results
• Notify the development team for any failure
• Repeat the process periodically, for example, once
  every hour
Continuous Integration
• Demo: using NAnt to build solution, run
  test cases, generate test result reports
Questions?
Happy Testing!

Weitere ähnliche Inhalte

Was ist angesagt?

Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
Richard Paul
 

Was ist angesagt? (20)

N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Junit
JunitJunit
Junit
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
 
Unit Tests And Automated Testing
Unit Tests And Automated TestingUnit Tests And Automated Testing
Unit Tests And Automated Testing
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Unit Testing Concepts and Best Practices
Unit Testing Concepts and Best PracticesUnit Testing Concepts and Best Practices
Unit Testing Concepts and Best Practices
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
 
Angular Unit Testing
Angular Unit TestingAngular Unit Testing
Angular Unit Testing
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
 
Unit Testing in Angular
Unit Testing in AngularUnit Testing in Angular
Unit Testing in Angular
 
User Interface Testing. What is UI Testing and Why it is so important?
User Interface Testing. What is UI Testing and Why it is so important?User Interface Testing. What is UI Testing and Why it is so important?
User Interface Testing. What is UI Testing and Why it is so important?
 
Automation test framework with cucumber – BDD
Automation test framework with cucumber – BDDAutomation test framework with cucumber – BDD
Automation test framework with cucumber – BDD
 
Data driven Automation Framework with Selenium
Data driven Automation Framework with Selenium Data driven Automation Framework with Selenium
Data driven Automation Framework with Selenium
 
Unit testing
Unit testing Unit testing
Unit testing
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Hybrid Automation Framework Development introduction
Hybrid Automation Framework Development introductionHybrid Automation Framework Development introduction
Hybrid Automation Framework Development introduction
 
Selenium IDE LOCATORS
Selenium IDE LOCATORSSelenium IDE LOCATORS
Selenium IDE LOCATORS
 

Andere mochten auch

Comunicaciones katherine ltda
Comunicaciones katherine ltdaComunicaciones katherine ltda
Comunicaciones katherine ltda
katherinareyesq
 
Comunicaciones katherine ltda
Comunicaciones katherine ltdaComunicaciones katherine ltda
Comunicaciones katherine ltda
katherinareyesq
 
ми6 исследования в интернете2
ми6 исследования в интернете2ми6 исследования в интернете2
ми6 исследования в интернете2
Maria Yurkovskaya
 
Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3
Cristian Sanchez
 

Andere mochten auch (20)

NUnit Features Presentation
NUnit Features PresentationNUnit Features Presentation
NUnit Features Presentation
 
Nunit
NunitNunit
Nunit
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit test
 
Unit Testing (C#)
Unit Testing (C#)Unit Testing (C#)
Unit Testing (C#)
 
Introduction to Unit Testing
Introduction to Unit TestingIntroduction to Unit Testing
Introduction to Unit Testing
 
Unit Test Fun
Unit Test FunUnit Test Fun
Unit Test Fun
 
Nogaaa
NogaaaNogaaa
Nogaaa
 
Comunicaciones katherine ltda
Comunicaciones katherine ltdaComunicaciones katherine ltda
Comunicaciones katherine ltda
 
438lecture1
438lecture1438lecture1
438lecture1
 
Comunicaciones katherine ltda
Comunicaciones katherine ltdaComunicaciones katherine ltda
Comunicaciones katherine ltda
 
Prej Tregueseve të Teuhid-it
Prej Tregueseve të Teuhid-itPrej Tregueseve të Teuhid-it
Prej Tregueseve të Teuhid-it
 
ми6 исследования в интернете2
ми6 исследования в интернете2ми6 исследования в интернете2
ми6 исследования в интернете2
 
An introduction to the Spring Framework
An introduction to the Spring FrameworkAn introduction to the Spring Framework
An introduction to the Spring Framework
 
12th Kuala Lumpur Boys' Brigade Weekly Meeting
12th Kuala Lumpur Boys' Brigade Weekly Meeting12th Kuala Lumpur Boys' Brigade Weekly Meeting
12th Kuala Lumpur Boys' Brigade Weekly Meeting
 
JetBrains ReSharper
JetBrains ReSharperJetBrains ReSharper
JetBrains ReSharper
 
Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3Establecimientos comerciales de la manzana 3
Establecimientos comerciales de la manzana 3
 
Safe Creative qué hacemos y cómo lo hacemos
Safe Creative qué hacemos y cómo lo hacemosSafe Creative qué hacemos y cómo lo hacemos
Safe Creative qué hacemos y cómo lo hacemos
 
Estrategia de Desarrollo Local Participativo-AGUJAMA
Estrategia de Desarrollo Local Participativo-AGUJAMAEstrategia de Desarrollo Local Participativo-AGUJAMA
Estrategia de Desarrollo Local Participativo-AGUJAMA
 
Sequential file programming patterns and performance with .net
Sequential  file programming patterns and performance with .netSequential  file programming patterns and performance with .net
Sequential file programming patterns and performance with .net
 
e-Marke Checkliste für Wohnungen
e-Marke Checkliste für Wohnungene-Marke Checkliste für Wohnungen
e-Marke Checkliste für Wohnungen
 

Ähnlich wie An Introduction to Unit Test Using NUnit

Ähnlich wie An Introduction to Unit Test Using NUnit (20)

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Automated testing overview
Automated testing overviewAutomated testing overview
Automated testing overview
 
Winning the battle against Automated testing
Winning the battle against Automated testingWinning the battle against Automated testing
Winning the battle against Automated testing
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Week 14 Unit Testing.pptx
Week 14  Unit Testing.pptxWeek 14  Unit Testing.pptx
Week 14 Unit Testing.pptx
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Qt test framework
Qt test frameworkQt test framework
Qt test framework
 
Testing
TestingTesting
Testing
 
Agile Acceptance testing with Fitnesse
Agile Acceptance testing with FitnesseAgile Acceptance testing with Fitnesse
Agile Acceptance testing with Fitnesse
 
Database Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTSDatabase Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTS
 
Tdd
TddTdd
Tdd
 
Unit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step TrainingUnit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step Training
 
Istqb foundation level day 1
Istqb foundation level   day 1Istqb foundation level   day 1
Istqb foundation level day 1
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
Unit testing in PHP
Unit testing in PHPUnit testing in PHP
Unit testing in PHP
 
DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 Fall 2014DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 Fall 2014
 
Software testing
Software testingSoftware testing
Software testing
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Manual testing - Introduction to Manual Software testing
Manual testing - Introduction to Manual Software testingManual testing - Introduction to Manual Software testing
Manual testing - Introduction to Manual Software testing
 
Unit Tesing in iOS
Unit Tesing in iOSUnit Tesing in iOS
Unit Tesing in iOS
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

An Introduction to Unit Test Using NUnit

  • 1. An Introduction to Unit Test Using NUnit Wei Li 08/2007
  • 2. Test, Test and More Test • Developer Test o Unit Test o Integration Test o Regression Test • QA Test o Integration Test o Regression Test o Performance Test o Stress Test • Customer/User Test o Acceptability Test o Useability Test
  • 3. What Is Unit Test • Self checking or validation to ensure your code works as expected • Developer’s test • Part of the construction cycle
  • 4. Where Does Unit Test Sit In Life Cycle • Requirement Gathering • Business System Design • Technical Design o Architecture Design o Technical System Design • Construction o Code and Unit Test • QA Test • User Test
  • 5. Unit Test Is Not • QA test • Customer/user test
  • 6. Why Unit Test • What? Write code to test code? • Why?
  • 7. Instant Feedback • Unit test provides the earliest opportunity to identify and fix a defect • The earlier a defect is caught, the less expensive it is to fix it • Done before integration • Like a dedicated QA/user sits next to you and test your code immediately
  • 8. Help Design And Write Better Code • If your code is hard to be unit tested, how can it be easily used, maintained and extended?
  • 9. Regression Checker • When new release of the external dependency comes, you can quickly run the unit tests to make certain the new release won’t break your system • Automatic change detector – When changes are made to the code, automated unit tests ensure that the change does not break something somewhere
  • 10. Good Way To Work On Legacy Code • Write unit test to get started with legacy code
  • 11. Good Way To Learn New Language and New API • Write unit test cases to learn and try new API • Your unit test cases become reusable knowledge base
  • 12. Good For Reporting a Defect • Write a test case to report a defect or bug in a system • When something fails, writing a unit test for that failure guarantees that it's fixed for once and for all.
  • 13. Save Time In Long Term • Unit test is reusable and repeatable • Unit test can be automated • Write once run forever
  • 14. There Is More Than One Way To Do It • Main() method with lots of print out • GUI “push that button” test • Debugger test
  • 15. Problems With The Above Methods • Is the test well structured? • Can it be automated? • Is the test repeatable? • Does it need human interaction? • Is it easy to be maintained ? • How to present test results?
  • 16. Stop Debugger Test • Debugger time is not recyclable • Debugger session is not reusable by others • Not a regression testing tool • Mental assertion is error-prone and boring
  • 17. Enter NUnit • A unit test framework written in C# • It uses attributes to identify unit test fixtures • It uses assertions for verification • It can be used to test any .NET code, not just C# • It provides a console and GUI interface • It can be integrated into VS.NET
  • 18. How Does NUnit Test Code Look Like? • Show me the code
  • 19. NUnit Attributes • Custom attribute injects more information to your class at compilation time • NUnit uses it to mark and identify unit test fixture
  • 20. NUnit Required Attributes – [TestFixture] • Used to indicate that a class contains test methods – [Test] • Used to indicate that a method within a test fixture should be run by the Test Runner application Example: Test1.cs
  • 21. NUnit Optional Attributes – [SetUp] • Used to indicate a setup method should be ran before each of the tests – [TearDown] • Used to indicate a tear down method should be ran after each of the tests are ran Example: Test2.cs
  • 22. NUnit Optional Attributes – [TestFixtureSetUp] • Used to indicate a setup method that will be ran once; before all other tests. This is the first method that is called before the tests are started. – [TestFixtureTearDown] • Used to indicate a tear down method that will be ran once; after all other tests have run. This is the last method that is called after all the tests have finished. Example: Test3.cs
  • 23. NUnit Optional Attributes – [ExpectedException(typeof(Exception))] • When you want an exception to be thrown • Will only pass if exception type was thrown – [Ignore(“Not ready yet")] Example: Test4.cs
  • 24. NUnit Assertion • It is all unit test cares about • NUnit provides a full set of assertions ready to be used • Assertion failure means test failure
  • 25. NUnit Assertion • Equality Asserts • Identity Asserts • Comparison Asserts • Type Asserts • Condition tests • Utility methods
  • 26. NUnit Equal Assertion • Assert.AreEqual(expected, real_value) • Assert.AreEqual(expected, real_value, “a message”) • Assert.AreNotEqual(expected, real_value) • Assert.AreNotEqual(expected, real_value, “a message”)
  • 27. NUnit Identity Assertion • Assert.AreSame(expected, real_value) • Assert.AreSame (expected, real_value, “a message”) • Assert.AreNotSame (expected, real_value) • Assert.AreNotSame (expected, real_value, “a message”)
  • 28. NUnit Condition Assertion • Assert.IsTrue() • Assert.IsFalse() • Assert.IsNull() • Assert.IsNotNull() • Assert.IsEmpty() • Assert.IsNotEmpty()
  • 30. Test Driven/Test First Development • Write a unit test case for a new functionality • Run the unit test and it will fail • Write just enough code to make the test pass • Run the unit test again and it passes • Refactory the code to make it better • Repeat the unit test • Repeat the cycle
  • 31. Continuous Integration • Get the latest version of the project from source control system • Build/compile the code • Run all unit test cases • Publish the build and test results • Notify the development team for any failure • Repeat the process periodically, for example, once every hour
  • 32. Continuous Integration • Demo: using NAnt to build solution, run test cases, generate test result reports