Browse Prior Art Database

Method and System of generating Unit Test cases based on analysis of program parameters and data items

IP.com Disclosure Number: IPCOM000236931D
Publication Date: 2014-May-22
Document File: 5 page(s) / 132K

Publishing Venue

The IP.com Prior Art Database

Abstract

Disclosed is a method to extend the xUnit architecture to generate complete test cases by identifying the parameter and data items from the program undergoing unit testing.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 52% of the total text.

Page 01 of 5

Method and System of generating Unit Test cases based on analysis of program parameters and data items

In software development, unit testing is important to assure source code quality, but it requires a significant amount of effort, especially for a procedural language with a complex data structure compared to an object oriented language .

xUnit framework is a Unit test framework that suggests basic component architecture of creating and managing test cases in an automated fashion. xUnit architecture is effective for object-oriented language that encapsulates data and logic in a class.

JUnit (for Java*), CppUnit (for C++), and NUnit (for .NET) have been implemented, where the frameworks generate test case templates. Another development system has introduced a unit-testing framework that creates test case templates for procedural languages.

The xUnit framework and related implementations of it provide the users with the test case template , but it is still very difficult to identify appropriate sets of data items in a large data structure to pass to a procedure so that a more complete test case can be generated, rather than a template.

An existing unit test tool generates unit test programs based on target test source code and allows the user to specify the input data and expected output. However, it has key differences when compared to the proposed solution. First, the source code analysis requires compiling the program and inspecting the compiler-generated intermediate data. The functioning of this requires the source to be error free and complete. The proposed solution, however, does not require compiling and can tolerate an incorrect source, since it is based on the static analysis of the program. In addition, the existing unit test tool implementation is not an extension of xUnit architecture; it is a proprietary implementation

The novel contribution is a method to extend the xUnit architecture to generate complete test cases by identifying the parameter and data items from the program undergoing unit testing. The identification of the parameter and data items involves combining the results from two different processes. This identified information is then used to help the developer/user to specify the input data and expected output, as well as the creation of stubs to called programs, etc. based on which the framework would generate a complete test case(s).

The core idea involves several aspects. The approach is to analyze source code to identify parameters of procedure by parsing the source. This helps identify the external calls and thus help generate stubs for called programs. Next, the data items are analyzed for the interface of the procedure to create a data model by leveraging the importer technology . Finally, a test data schema is generated b...