Unit Testing
Unit Testing
Unit Testing
UNIT TESTING is a type of software testing
The purpose is to validate that each unit of the software code performs as
expected.
1.Unit tests help to fix bugs early in the development cycle and save
costs.
2.It helps the developers to understand the code base and enables them
to make changes quickly.
4.Unit tests help with code re-use. Migrate both your code and your
tests to your new project. Tweak the code until the tests run again.
Unit Testing Levels
How to do Unit Testing
• They would later comment out and finally remove the test code when the
application is deployed.
• Using an automation framework, the developer codes criteria into the test to
verify the correctness of the code.
• During execution of the test cases, the framework logs failing test cases.
• Many frameworks will also automatically flag and report, in summary, these
failed test cases.
1. Black box testing: that involves testing of user interface along with input and output.
2. White box testing: that involves testing the functional behaviour of the software
application.
3. Gray box testing: that is used to execute test suites, test methods, test cases and
performing risk analysis.
•In White Box testing internal structure (code) is known
•In Black Box testing internal structure (code) is unknown
•In Grey Box Testing internal structure (code) is partially known.
What is a Test Suite?
Test suite is a container that has a set of tests which helps testers in executing
and reporting the test execution status.
Unit Testing Tools // Framework
1.Junit: Junit is a free to use testing tool used for Java programming language.
It provides assertions to identify test method.
2.NUnit: NUnit is widely used unit-testing framework use for all .net
languages. It is an open source tool which allows writing scripts manually. It
supports data-driven tests which can run in parallel.
11 Programming Languages which are designed and
developed by Microsoft are:
•C#.NET
•VB.NET
•C++.NET
•J#.NET
•F#.NET
•JSCRIPT.NET
•WINDOWS POWERSHELL
•IRON RUBY
•IRON PYTHON
•C OMEGA
•ASML(Abstract State Machine Language)
Data-driven testing (DDT), also known as table-driven
testing or parameterized testing,
4. EMMA: EMMA is an open-source toolkit for analyzing and reporting code written in
Java language. Emma support coverage types like method, line, basic block. It is Java-
based so it is without external library dependencies and can access the source code.
5. PHPUnit: PHPUnit is a unit testing tool for PHP programmer. It takes small portions
of code which is called units and test each of them separately. The tool also allows
developers to use pre-define assertion methods to assert that a system behave in a certain
manner.