Unit testing simply means checking a particular software component, while building a software product. Unit testing frameworks provide the platform for performing tests on a module. A framework is an automation tool, that provides benefit of integrating the required function libraries, test data sources and other modules. Choosing the right framework is imperative to maintain cost.
Few key responsibilities lies underneath the choice of a testing framework :
Defining what is to be expected from the system.
Execution of test cases step by step.
Finding deviations in actual and expected results, and reporting bugs if any.
Unit testing is a very initial level of testing, which can be performed on any language. The programming languages may vary from C,Java, Ruby, Python etc.
Let us take Java as an example and have an understanding about the various frameworks that are available for programmers.
Testing frameworks for Java :
Arquillian- This is a testing platform for JVM that eases the task of developers for creating functional, integration and acceptance tests for Java. It also enables one to manage test case bundling and grouping dependant classes and resources. Capable of capturing results and creating reports.
Jtest- An automation framework also known as 'Parasoft Jtest' , as it is developed by the organisation Parasoft. It is a Java testing tool that helps us to generate and execute unit test cases, static code analysis, data flow static analysis, metric analysis, regression testing, run-time error detection. It also enables detection of memory leaks, checking security vulnerabilities etc.
The Grinder- It is a load testing tool, that has the potential to test a component using load injector machines. Load testing can be done on HTTP web servers, SOAP and REST web services, and application servers and include custom protocols. The test scripts are written in Jython and Clojure languages. It has a GUI console that facilitates monitoring client connections, SSL, Proxy etc.
TestNG– It covers a wide range of testing types – unit , functional, integration etc. Supports use of annotations, code testing in a multi- thread safe, flexible test configurations, data driven testing support for parameters.
Junit– A unit testing framework meant for Java programming language. It is a part of xUnit architecture for unit testing framework. One can write repeatable tests.
Jwalk- This has been designed to support a testing paradigm called Lazy systematic Unit Testing. It conforms to specifications laid down by Lazy , by static and dynamic analysis, and performs tests of any Java class supplied by a programmer.
Mockito- Is an open source testing framework. Allows programmers to create and test mock objects in automated unit tests for Test driven Development(software development process , requirements are turned into very specific test cases) or Behaviour Driven development(an application is designed as per the behaviour it must convey to the observer).
Powermock- Uses custom classloader and bytecode manipulator to enable mocking of static methods,removal of static initializer, constructors, final classes, methods.
Testing framework for C :
There is a testing framework for C called Check. This tools facilitates running tests in separate address space, so catching any errors or segmentation faults becomes easy. It allows reporting of test results in many formats - Subunit, TAP, XML , and generic logging format.
Platforms supported by Check - it works on many UNIX compatible environments like GNU/Linux, GNU/Hurd, BSD and MacOS. An interesting fact about Check is that, if tests are performed on any POSIX platform without some functionality like fork, Check disables the related features and is still functional.
Further classification of testing Frameworks can be made on the basis of the following :
Script based unit tests - simply write and run test scripts
Function- based unit tests - write customized test cases and run
Class - based testing - write class based test cases and parameterized ones.
Testing is vast and so are the frameworks. Choose a testing framework wisely, carefully analyzing the requirements to be met and the final outcome.