Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

Published in: Technology
  • Be the first to comment


  1. 1. Dinuka Malinda Peiris MalalanayakeAssociate QA Engineer -Excel Technology Lanka
  2. 2. BACKGROUND What is an Unit testing? About Nunit. “Any Unit Test is better than none” How to do the Unit testing with C#? Nunit Assertion. Nunit Attributes. Best Practice Advantages Disadvantages Similar Products.
  3. 3. WHAT IS AN UNIT TESTING? A unit test is a procedure used to verify that a particular module of source code is working “Any Unit Test is better than none” properly Company wants to achieve three related goals  Faster time-to-market  Higher quality  More flexibility
  4. 4. ABOUT NUNIT. NUnit is an open source unit testing framework for Microsoft.NET. “Any Unit Test is better than none” It serves the same purpose as JUnit does in the Java world, and is one of many in the xUnit family Provide both GUI and Console
  5. 5. HOW TO DO THE UNIT TESTING WITH C#? “Any Unit Test is better than none”
  6. 6. NUNIT ASSERTION Equality Identity “Any Unit Test is better than none” Comparison Condition String
  7. 7. NUNIT ATTRIBUTES Test Fixture Test “Any Unit Test is better than none” Setup Teardown Test Fixture Setup/ Teardown Expected Exception Platform Category Explicit Suite Ignore
  8. 8. BEST PRACTICE No conditional logic – Switch, if No loops “Any Unit Test is better than none” No exception catching Use appropriate method names Informative assertion message Separation per type
  9. 9. ADVANTAGES Fast Test Isolation “Any Unit Test is better than none” Environment Isolation – Use Mock Objects Unit testing gives you a safety net when programmers refactor or add functionality Unit tests can be used as documentation for other programmers Development process becomes more flexible
  10. 10. DISADVANTAGES Unnecessary Unit Tests can lead to considerably high maintenance cost to your overall project “Any Unit Test is better than none”
  11. 11. SIMILAR PRODUCTSProgramming Language Unit Testing ToolJava – J2SE / J2EE JunitJava – J2ME “Any Unit Test is better than none” JMUnitC CUnitC++ CppUnitphp PHPUnitPython PyUnit / py.test