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. 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. 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. HOW TO DO THE UNIT TESTING WITH C#?
“Any Unit Test is better than none”
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. 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. 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. DISADVANTAGES
Unnecessary Unit Tests can lead to considerably
high maintenance cost to your overall project
“Any Unit Test is better than none”
11. SIMILAR PRODUCTS
Programming Language Unit Testing Tool
Java – J2SE / J2EE Junit
Java – J2ME
“Any Unit Test is better than none”
JMUnit
C CUnit
C++ CppUnit
php PHPUnit
Python PyUnit / py.test