Abstract:
Testing of software plays a vital part in the software development process. It is the phase in the software development life cycle that make sure the developed software is functionally correct. Software faults can be expensive when the fault is found at the production system therefore it is essential to find software errors at the development stages of the project when the cost is minimum. Testing makes sure the software which is developed covers functional and nonfunctional requirements.
Unit tests take an essential place in software testing and it is the earliest test a developer or a tester can perform on the implementation, defects can be detected at early stages, and fixes can be done with lesser cost due to lesser dependencies. Even though it is essential to implement unit tests, it is not the case in reality. Most software companies rely heavily on end to end testing. The main reason for lack of testing at the unit test level is due to its time-consuming nature and it will not provide functional coverage whereas by performing end to end tests, end-user requirements can be captured and tested. In reality, approximately two-thirds of the development time is spent on unit testing related activities and the rest of the time is spent on designing and implementation. However, due to time constraints and budget limitations, allocating a large portion of the time for unit testing is not practical.
In this research, I came up with a solution to address the above-mentioned issues and to eliminate the requirement of writing unit tests manually. I implemented a tool which generates unit tests for applications that are implemented in C++. The process is completely automated and the unit test files generated by the tool are human-readable. Developers no longer need to implement unit tests however they may have to validate the correctness of the generated unit tests and as desired they can extend the meaningfulness of the generated unit tests.
The tool is embedded with three test data generation mechanisms; Random Value Generation, Goal Oriented Test Generation and Feedback driven Test Data Generation. The tool successfully produced test data to attain approximately 95% of code coverage with data generation mechanisms except Random value generation in multiple test experiments however when the test unit has a higher number of branches Feedback driven test data generation mechanism showed better performance as it took lesser time for data generation. Time growth is exponential when the number of branches gets increased in Goal Orientated Test Generation. This tool can be extended for complex structures and I can successfully conclude that the research is successful as the tool showed higher accuracy