SlideShare a Scribd company logo
3
Most read
6
Most read
11
Most read
Dinuka Malinda Peiris Malalanayake
Associate QA Engineer -Excel Technology Lanka
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.
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
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
HOW TO DO THE UNIT TESTING WITH C#?




                                      “Any Unit Test is better than none”
NUNIT ASSERTION
 Equality
 Identity




                  “Any Unit Test is better than none”
 Comparison

 Condition

 String
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
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
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
DISADVANTAGES
   Unnecessary Unit Tests can lead to considerably
    high maintenance cost to your overall project




                                                      “Any Unit Test is better than none”
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

More Related Content

PPT
N Unit Presentation
PPTX
Unit testing with NUnit
PPTX
Unit Testing Using N Unit
PDF
An Introduction to Unit Test Using NUnit
PPTX
Selenium WebDriver training
PPSX
PPS
JUnit Presentation
N Unit Presentation
Unit testing with NUnit
Unit Testing Using N Unit
An Introduction to Unit Test Using NUnit
Selenium WebDriver training
JUnit Presentation

What's hot (20)

PPTX
Introduction to Selenium Web Driver
PPTX
Test Automation and Selenium
PPT
Selenium Concepts
PDF
An Introduction to Test Driven Development
PPT
Test automation using selenium
PPTX
Hybrid automation framework
PPTX
An overview of selenium webdriver
PDF
JUnit & Mockito, first steps
PPTX
TestNG Framework
PPTX
TestNG with selenium
PPTX
Unit Testing And Mocking
PDF
Unit testing with JUnit
PDF
Selenium with Cucumber
PPT
Selenium Automation Framework
PPTX
Automation - web testing with selenium
ODP
An Introduction To Jenkins
PPTX
Test automation using selenium
PPTX
Jenkins CI presentation
PPT
Basic software-testing-concepts
PPTX
Unit tests & TDD
Introduction to Selenium Web Driver
Test Automation and Selenium
Selenium Concepts
An Introduction to Test Driven Development
Test automation using selenium
Hybrid automation framework
An overview of selenium webdriver
JUnit & Mockito, first steps
TestNG Framework
TestNG with selenium
Unit Testing And Mocking
Unit testing with JUnit
Selenium with Cucumber
Selenium Automation Framework
Automation - web testing with selenium
An Introduction To Jenkins
Test automation using selenium
Jenkins CI presentation
Basic software-testing-concepts
Unit tests & TDD
Ad

Viewers also liked (20)

PPTX
NUnit Features Presentation
PPT
Nunit
PPTX
PDF
How and what to unit test
PPTX
Are you new to Apache Camel
PDF
Nuget is easier than you think and you should be using it as both a consumer ...
PPTX
Using NuGet the way you should - TechDays NL 2014
PPTX
Using nu get the way you should svcc
PPTX
Developing NuGet
PPTX
Unit Testing (C#)
PPT
Introduction to the Web API
ODP
Easymock Tutorial
PPTX
Types of pattern
PPT
Excellent rest using asp.net web api
PPTX
ASP.NET WEB API
PDF
Domain-Driven Design with ASP.NET MVC
PPTX
PPTX
Implementing DDD with C#
PPT
ASP.NET MVC Presentation
PPTX
Introduction to ASP.NET MVC
NUnit Features Presentation
Nunit
How and what to unit test
Are you new to Apache Camel
Nuget is easier than you think and you should be using it as both a consumer ...
Using NuGet the way you should - TechDays NL 2014
Using nu get the way you should svcc
Developing NuGet
Unit Testing (C#)
Introduction to the Web API
Easymock Tutorial
Types of pattern
Excellent rest using asp.net web api
ASP.NET WEB API
Domain-Driven Design with ASP.NET MVC
Implementing DDD with C#
ASP.NET MVC Presentation
Introduction to ASP.NET MVC
Ad

Similar to Nunit (20)

PPT
Unit testing with java
PDF
Testing in java
PDF
Designing Top-Class Test Suites for Web Applications
PDF
TDD Workshop UTN 2012
DOCX
JUnit_Guide_Expanded_Presentation[1].docx
DOCX
JUnit_Guide_Expanded_Presentation[1].docx............................
DOCX
JUnit_Guide_Expanded_Presentation[1].docx
PPT
Test Automation Principles
PDF
junit-160729073220 eclipse software testing.pdf
PPS
Why Unit Testingl
PPS
Why Unit Testingl
PPS
Why unit testingl
PPTX
When & How to Successfully use Test Automation for Mobile Applications
DOCX
Test Driven Development
PDF
Testing Plug-in Architectures
PPTX
Presentation sem 1.pptx
PDF
What is JUnit? | Edureka
PDF
5 Best Unit Test Frameworks to Automate Unit Tests
PDF
JUnit Testing Framework A Complete Guide.pdf
PDF
Introduction To UnitTesting & JUnit
Unit testing with java
Testing in java
Designing Top-Class Test Suites for Web Applications
TDD Workshop UTN 2012
JUnit_Guide_Expanded_Presentation[1].docx
JUnit_Guide_Expanded_Presentation[1].docx............................
JUnit_Guide_Expanded_Presentation[1].docx
Test Automation Principles
junit-160729073220 eclipse software testing.pdf
Why Unit Testingl
Why Unit Testingl
Why unit testingl
When & How to Successfully use Test Automation for Mobile Applications
Test Driven Development
Testing Plug-in Architectures
Presentation sem 1.pptx
What is JUnit? | Edureka
5 Best Unit Test Frameworks to Automate Unit Tests
JUnit Testing Framework A Complete Guide.pdf
Introduction To UnitTesting & JUnit

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Modernizing your data center with Dell and AMD
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPT
Teaching material agriculture food technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
KodekX | Application Modernization Development
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
cuic standard and advanced reporting.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Dropbox Q2 2025 Financial Results & Investor Presentation
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
Modernizing your data center with Dell and AMD
The AUB Centre for AI in Media Proposal.docx
Understanding_Digital_Forensics_Presentation.pptx
Teaching material agriculture food technology
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
KodekX | Application Modernization Development
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Spectral efficient network and resource selection model in 5G networks
cuic standard and advanced reporting.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication

Nunit

  • 1. Dinuka Malinda Peiris Malalanayake Associate QA Engineer -Excel Technology Lanka
  • 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”
  • 6. NUNIT ASSERTION  Equality  Identity “Any Unit Test is better than none”  Comparison  Condition  String
  • 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