Unit Testing
<ul><li>What is Unit Testing ? </li></ul><ul><li>Difference between Unit and System Testing.  </li></ul><ul><li>How Develo...
What is Unit Testing? <ul><li>A unit is the smallest testable part of an application. </li></ul><ul><li>Unit testing refer...
When Unit testing is performed. Requirement Phase / SRS / Prototype Designing Phase: HLD, LLD, Program Specification Codin...
Hierarchy if Testing System Testing Integration Testing Functional Testing Unit Testing UAT (User Acceptance Testing)
Difference between Unit and System Testing. <ul><li>Unit Testing System Testing </li></ul><ul><li>Unit testing is performe...
Types of Unit Testing? <ul><li>Self Testing </li></ul><ul><li>In Self Testing, Unit testing shall be performed by the deve...
Test Case Design Techniques <ul><li>Test case design techniques can be broadly split into two main  </li></ul><ul><li>cate...
Test Case Design Techniques.....Cont. <ul><li>Equivalence Class  Partitioning </li></ul><ul><ul><li>Input values to a prog...
Test Case Design Techniques…..Cont. <ul><li>If the input data to the program is specified by a range of values: </li></ul>...
Test Case Design Techniques….Cont. <ul><li>Boundary Testing : </li></ul><ul><ul><li>a black box testing technique </li></u...
Best Practices  Thank you
Upcoming SlideShare
Loading in …5
×

Unit testing

2,095 views

Published on

Published in: Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,095
On SlideShare
0
From Embeds
0
Number of Embeds
81
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Unit testing

  1. 1. Unit Testing
  2. 2. <ul><li>What is Unit Testing ? </li></ul><ul><li>Difference between Unit and System Testing. </li></ul><ul><li>How Developer will perform Unit Testing? </li></ul><ul><li>Test Case Design Techniques </li></ul>Agenda
  3. 3. What is Unit Testing? <ul><li>A unit is the smallest testable part of an application. </li></ul><ul><li>Unit testing refers to the practice of developers to test the Code. </li></ul><ul><li>Unit testing is a procedure used to validate that individual units of source code are working properly. </li></ul><ul><li>The objective in unit testing is to isolate a unit and validate its correctness. </li></ul><ul><li>Unit testing is typically done by the developers and not by end-users. </li></ul><ul><li>Its also called a component level testing. </li></ul>
  4. 4. When Unit testing is performed. Requirement Phase / SRS / Prototype Designing Phase: HLD, LLD, Program Specification Coding / Creating Unit Test Cases UNIT TESTING The Unit Test Cases are created by the respective developers of the Module while performing the Unit Testing. The Tester can get the information either from all the documents or from any one document.
  5. 5. Hierarchy if Testing System Testing Integration Testing Functional Testing Unit Testing UAT (User Acceptance Testing)
  6. 6. Difference between Unit and System Testing. <ul><li>Unit Testing System Testing </li></ul><ul><li>Unit testing is performed Done by the Testers. </li></ul><ul><li>by the developers. </li></ul><ul><li>Unit tests are required at System tests are generally </li></ul><ul><li>various sizes of Units under Test. tests of the system. </li></ul><ul><li> </li></ul><ul><li>The goal of unit testing The system tests are used </li></ul><ul><li>is to isolate each part of the to verify that we deliver the </li></ul><ul><li>Program and show that the correct functionality and we </li></ul><ul><li>Individual parts are correct. would preferably model the </li></ul><ul><li> tests after the use-cases. </li></ul><ul><li>It involves checking that each feature System Testing is not about </li></ul><ul><li>specified in the &quot;Component Design&quot; checking the individual parts </li></ul><ul><li>has been implemented in the component. of the design, but about checking </li></ul><ul><li>the system as a whole. </li></ul>
  7. 7. Types of Unit Testing? <ul><li>Self Testing </li></ul><ul><li>In Self Testing, Unit testing shall be performed by the developer for the module which he has developed. </li></ul><ul><li>Peer testing </li></ul><ul><li>In Peer Testing, Unit testing shall be performed by the peer developer for the module which other developers have developed. </li></ul><ul><li>Positive Testing </li></ul><ul><li>Test cases should be designed to show that the unit under test does what it is supposed to do. The test designer should walk through the relevant specifications; each test case should test one or more statements of specification. </li></ul><ul><li> Suitable techniques : </li></ul><ul><li>Equivalence partitioning </li></ul><ul><li>Negative Testing </li></ul><ul><li>Existing test cases should be enhanced and further test cases should be designed to show that the software does not do anything that it is not specified to do. This step depends primarily upon error guessing, relying upon the experience of the test designer to anticipate problem areas. </li></ul><ul><li>Suitable techniques : </li></ul><ul><li>Boundary Value Analysis </li></ul>
  8. 8. Test Case Design Techniques <ul><li>Test case design techniques can be broadly split into two main </li></ul><ul><li>categories. Black box techniques use the interface to a unit and a </li></ul><ul><li>description of functionality, but do not need to know how the inside of a </li></ul><ul><li>unit is built. White box techniques make use of information about how the </li></ul><ul><li>inside of a unit works. There are also some other techniques which do not </li></ul><ul><li>fit into either of the above categories. Error guessing falls into this </li></ul><ul><li>category. </li></ul><ul><li>Black box (functional) White box (structural) </li></ul><ul><li>Equivalence partitioning Path Coverage </li></ul><ul><li>Boundary value analysis Data flow bases testing </li></ul>
  9. 9. Test Case Design Techniques.....Cont. <ul><li>Equivalence Class Partitioning </li></ul><ul><ul><li>Input values to a program are partitioned into equivalence classes. </li></ul></ul><ul><ul><li>Generally adopt the following strategy: </li></ul></ul><ul><ul><ul><li>If the input is a range, define one valid and two invalid classes. </li></ul></ul></ul><ul><ul><ul><li>If the input is a specific value, define one valid and two invalid cases. </li></ul></ul></ul><ul><ul><li>Two inputs are in the same Equivalence Class if they are handled similarly by system. </li></ul></ul><ul><ul><ul><li>eg. data field valid value in 1-50 So, 20, 38, 1, 47 belong to the same Equivalence Class. </li></ul></ul></ul><ul><ul><ul><li>no need to test multiple values from same Equivalent Class. </li></ul></ul></ul><ul><ul><ul><li>test valid and invalid equivalence classes. </li></ul></ul></ul>
  10. 10. Test Case Design Techniques…..Cont. <ul><li>If the input data to the program is specified by a range of values: </li></ul><ul><ul><li>e.g. numbers between 1 to 5000. </li></ul></ul><ul><ul><li>one valid and two invalid equivalence classes are defined. </li></ul></ul>1 5000 <ul><li>If input is an enumerated set of values: </li></ul><ul><ul><li>e.g. {a,b,c}, one equivalence class for valid input values </li></ul></ul><ul><ul><li>another equivalence class for invalid input values should be defined. </li></ul></ul><ul><li>There are three equivalence classes: </li></ul><ul><ul><li>the set of negative integers, set of integers in the range of 1 and 5000, </li></ul></ul><ul><ul><li>integers larger than 5000. </li></ul></ul><ul><li>The test suite must include: </li></ul><ul><ul><li>representatives from each of the three equivalence classes: </li></ul></ul><ul><ul><li>a possible test suite can be: {-5,500,5001}. </li></ul></ul>1 5000
  11. 11. Test Case Design Techniques….Cont. <ul><li>Boundary Testing : </li></ul><ul><ul><li>a black box testing technique </li></ul></ul><ul><ul><li>special class of equivalence testing </li></ul></ul><ul><ul><li>assumption is that the developers often fail to look at the boundaries of the equivalence classes. </li></ul></ul><ul><li>Boundary value analysis: </li></ul><ul><ul><li>select test cases at the boundaries of different equivalence classes. </li></ul></ul><ul><ul><li>In the Previous Example the Boundry Value Analysis will be : </li></ul></ul><ul><ul><li>test cases must include the values: {0,1,5000,5001}. </li></ul></ul>1 5000
  12. 12. Best Practices Thank you

×