<<Previous Post << Complete Tutorial>> Next Post>>
What is Unit Testing?
Unit Testing is one of the levels of Software Testing, where the testing is performed on the isolated smallest units of Software Application programs. Unit in Unit Testing is nothing but the smallest piece of software code which is testable. Examples of a Unit in programming are methods (also known as functions, procedures), classes and interfaces. So the goal of Unit Testing is to isolate the smallest portion of application code which can be individually tested and verify all the isolated units are developed correctly.
Unit Testing & Software Testing Levels: Testing in Software Development Life Cycle is performed in four stages (i.e. Testing Levels – Unit Testing, Integration Testing, System Testing and Acceptance Testing). Unit Testing is one of the four testing levels, which is performed first during the development stage of the required Software Application. Remaining Testing Levels will be performed after Unit Testing.
- > The cost of the defects identified and fixed during Unit Testing is very less compared to the cost of the defects which are later identified and fixed during the later high levels of testing phases.
- > With Unit Testing, defects are identified at the early stages of Software Development Life Cycle, which result in the reduction of bug fixing cost along with time.
- > As part of regression testing, the Unit Tests can be automated and run every time along with the UI automated, when the changes are made to the application code.
- > Though Unit Testing can be performed manually, they are generally automated for repetitive execution of Unit Test for each and every change, as part of regression testing.
- > Based on the programming language, Unit testing frameworks like JUnit, TestNG, NUnit etc. can be used in creating Automation Frameworks for creating Automated Unit Tests.
- > With the help of mocking, we isolate the Units by removing their need for interacting with any external dependent methods or services by simulating their behavior.
- > Frequent and continuous execution of Unit Testing is recommended for achieving the higher quality of the software build.
- > Defects identified during Unit Testing must be fixed there itself, without allowing them to move into the other testing phases like Integration testing etc.
Next Steps:
- > To learn more about Software Testing, continue to the next post (Click on the Next Post link below)
- > Check complete Software Testing Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning ?
<<Previous Post << Complete Tutorial>> Next Post>>