Abstract:
According to one aspect of the invention, a system and method for unit and regression testing has been developed. The system is capable to automate unit/regression test case preparation, remote execution, provide XML based assert mechanism to evaluate test results, maintenance and versioning. The present system enables model driven testing of domain specific languages and provides a user friendly mechanism to perform Unit and Regression Testing.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
       [0001]    This application claims priority to copending U.S. Provisional Application entitled, “AGILE UNIT AND REGRESSION TESTING FRAMEWORK FOR DOMAIN SPECIFIC LANGUAGES,” having Ser. No. 61/576,145 filed Dec. 15, 2011, which is entirely incorporated herein by reference. 
     
    
     FIELD OF THE INVENTION 
       [0002]    The present invention relates generally to the domain of testing. More particularly, the invention relates to a unit and regression testing of model aware domain specific languages. 
       BACKGROUND OF THE INVENTION 
       [0003]    Testing has always been a crucial part in development of any product. Unfortunately, in addition to ad-hoc changing business requirements, a pressure to meet strict project deadlines along with dynamic real-time scenarios and, often a product testing is neglected and given less priority. Particularly, while testing, a conventional approach of integration and system testing is predominantly preferred over a unit testing to avoid repetitive test cases creation. If testing is avoided at unit level it often results in cumbersome debugging at unit level for errors detected during integration or system testing. 
         [0004]    Traditionally while unit testing, a “Code First and Write Test case Next [CFWN]” approach is employed and thus development and testing frameworks are designed accordingly in compliance with the said approach. This approach, in addition to being time consuming and effort prone, doesn&#39;t provide for an integrated environment for testing and development. Thus a developer is forced to switch between integrated development environment IDE&#39;s compromising the user friendliness of the environment. 
         [0005]    Alternatively, a test driven development (TDD) approach is observed to be efficient in offering greater flexibility to unit testing practice and is adaptable to design an integrated development environment. In one of his findings and while modifying the TDD approach, Mr. Kent Beck of Three Rivers Institute, also observed that TDD and XP suggest that there is no need to add abstraction layers for extensibility until there is actually a need for them. However, still the development community is not sure about exploring this approach because of pertinent issues faced while initiating development itself and lack of such an integrated development platform. 
         [0006]    Moreover, in the existing development environment practicing TDD, developers need to manually develop the test cases. One of the systems Zen Test, though discloses automation of the test cases development, however, still faces a problem with reusability of those test cases. 
         [0007]    Thus, while choosing TDD for an effective employment of a development process, an automated test case generation system is desirable that would optimize the overall development. In one of the publications, “Wasting Time With Test Driven Development”, Mr. Vineet Sinha of architex acknowledges the shortcomings of the TDD approach, which includes lack of 100% code coverage, absence of user feedback, poor quality of documentation, architectural standards are not maintained and many a times the approach can be a roadblock for innovation. 
         [0008]    Even though while aforesaid problems persist with TDD, a dominant and comprehensive advantage of reduced time of work, evolving and adapting to changing environment, simple unit test case generation is believed to be far more beneficial to the development community. 
         [0009]    In Code First Test Next (CFTN) approach, post execution, developers need to manually inspect each output file. Moreover, these test cases are not versioned for future reusability; hence there are fair chances of them getting purged over period of time. 
         [0010]    Though, there are systems like Xunit.net that provide test cases to comply with TDD for an efficient development, however, these systems don&#39;t facilitate combining of various test cases together as a test suite, as such test suit is observed to be effective in triggering a regression testing. 
         [0011]    In light of the foregoing problem, there is a need of a robust as well as a structured and user-friendly system of unit/regression testing capable of testing large scale business critical and database centric enterprise applications while complying with all the real-time aspects that arise during testing. 
       OBJECTIVES OF THE INVENTION 
       [0012]    The principle object of the present invention is to develop a unit/regression framework that supports agile methodology of “Prepare Test first and Code next.” 
         [0013]    Another significant object of the invention is to develop robust and user friendly unit/regression testing solution for large scale business applications. 
         [0014]    It is another object of the present invention to enable model driven testing of domain specific language in general. 
         [0015]    Another significant object of the present invention is to provide a user friendly, XML based assert mechanism to compare expected and actual output of unit test module. 
         [0016]    Yet another object of the invention is to provide an integration of development and testing environments. 
         [0017]    Another object of the invention is to facilitate versioning of test cases for future reuse. 
       SUMMARY 
       [0018]    In one of the preferred embodiments of the present invention, a system and method for unit and regression testing is envisaged to offer greater flexibility and a XML based assert mechanism for comparing expected and actual output to the development environment designed in compliance with TDD approach. The system is configured to automate unit/regression test case preparation, remote execution, maintenance and versioning such that developers even before initiating development would able to envision the test cases. The system inherits Xunit family of unit and regression testing frameworks to provide a unique solution to address unit and regression testing of domain specific languages in model driven testing environment. 
         [0019]    The system comprises of a repository, a modeling unit, code generating module, an executing module and a comparing module. The system enables combining of all test cases together to form a test suite and triggers them as regression test-suite. In one of the embodiment of the invention, an Eclipse plug-in is employed to code business logic using an intelligent text editor. The system automates the process of submitting test cases and writes output to a flat file. In a preferred embodiment, the code is checked into Star Team for versioning and ensuring reusability of test cases. 
         [0020]    This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter. 
         [0021]    Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention. These and other features of the present invention will become more fully apparent from the following description, or may be learned by the practice of the invention as set forth hereinafter. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0022]    The foregoing summary, as well as the following detailed description of preferred embodiments, is better understood when read in conjunction with the appended drawings. For the purpose of illustrating the invention, there is shown in the drawings example constructions of the invention; however, the invention is not limited to the specific system and method disclosed in the drawings: 
           [0023]      FIG. 1  depicts the logical flow of the system and the various stages involved in the same. 
           [0024]      FIG. 2  represents the various components of the system. 
           [0025]      FIG. 3  shows the components involved in the process of generating the output filel. 
           [0026]      FIG. 4  highlights the steps used to obtain the result from the result generating module. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0027]    Some embodiments of this invention, illustrating all its features, will now be discussed in detail. The words “comprising,” “having,” “containing,” and “including,” and other forms thereof, are intended to be equivalent in meaning and be open ended in that an item or items following any one of these words is not meant to be an exhaustive listing of such item or items, or meant to be limited to only the listed item or items. 
         [0028]    It must also be noted that as used herein and in the appended claims, the singular forms “a,” “an,” and “the” include plural references unless the context clearly dictates otherwise. Although any systems and methods similar or equivalent to those described herein can be used in the practice or testing of embodiments of the present invention, the preferred, systems and methods are now described. 
         [0029]    The present invention describes a system to automate unit/regression test case preparation, remote execution, XML based assertion of test results, maintenance and versioning of the same. The invention provides a unique solution to address unit and regression testing of domain specific languages in model driven testing environment. 
         [0030]    Referring to  FIG. 1 , the diagram depicts the logical flow of the system and shows the main stages involved in the system.  FIG. 1  shows the 5 main stages of designing test cases, test case preparation, construction, unit testing and finally versioning of the test cases. The designing stage involves modeling and generation of templates using MasterCraft®—an integrated framework to develop large scale distributed enterprise applications using model driven techniques. MasterCraft comprises of a modeling tool, code generators, high level specification language, GUI generator and runtime libraries. MasterCraft® generated code templates are used to build unit and integration test drivers. Modeling unit provides an user interface to capture class model of application design. Model entered by user is stored in a centralized repository which is later queries to export model to generated operations and other artifacts. Test case preparation involves populating of input XML and expected output XML. The construction phase consists of writing code and building unit test load with the help of eclipse plug-in. 
         [0031]    In the next phase of unit testing, execution of unit test load is done and actual output and expected output are compared. The unit test load comprises of object binaries, drive modules and application library code. All of these components work collaboratively to retrieve any code/design defect from the results. The application design and/or code are again modified accordingly. Lastly in the versioning phase using Star Team the test cases are checked in for further reusability. Users can manually check-in the test cases in version management tools like Star Team and the like for future reuse and to build regression test suites. 
         [0032]    Now referring to  FIG. 2 , various components required to implement the present invention is provided. A modeling unit ( 202 ), which accepts input from the repository ( 201 ), models artifacts to generate a unit testing module or an operation ( 200 ). 
         [0033]    Further referring to  FIG. 2 , a code generating module ( 203 ) is used to create blank operation template. The blank template includes the empty operation shell used by developer to code the business logic. For this purpose the code generating module ( 203 ) uses MasterCraft® tool. MasterCraft® automated code generators are executed on model to generate Q++ code templates and application library code. These code generators run on OMVS. The code generating module ( 203 ) also generates input XML ( 208 ) and expected output XML ( 210 ). 
         [0034]    Still further referring to  FIG. 2 , an eclipse plug-in ( 204 ), is used to code business logic in Q++ language using intelligent text editor. The code generated by the code generating module ( 203 ) is compiled from an action plug-in which invokes remote command to copy code, translate and invoke C++ compiler on mainframe. The eclipse plug-in uses unit test stubs ( 206 ) and system libraries ( 207 ) to create an executable unit test load. Unit test stubs consists of wrappers to call business functionality coded by developer using operation template. System libraries are shipped with MasterCraft® toolset and include functionalities to provide utility classes, file read-write, memory management and database communication wrappers. 
         [0035]    Still further referring to  FIG. 2 , an execution module ( 205 ) provides an option on the system to auto-submit a job from eclipse plug-in. This internally invokes JCL that reads input XML ( 208 ), calls unit test load to execute the code and write the output to output file ( 209 ). 
         [0036]    Still further referring to  FIG. 2 , an expected output XML ( 210 ) generated by the code generating module ( 203 )is further used during assert based comparison as discussed in  FIG. 4 . 
         [0037]    Now referring to  FIG. 3 , a XML Generator ( 302 ) present in the system is used to generate actual output XML ( 303 ) based on the output file ( 209 ) generated by text execution ( 205 ). 
         [0038]    Now referring to  FIG. 4 , an input module ( 401 ) consisting of the Actual Output XML ( 303 ) and the Expected output XML ( 210 )is compared by using an assert based comparing module ( 402 ). The assert based comparing module ( 402 ) compares the actual output XML ( 303 ) and the Expected output XML ( 210 ) and automatically decides whether the test case has passed or failed. 
         [0039]    The result generating module ( 403 ) reports the defects unveiled during comparison. The defects can be either design defects or logical defects in the code. These defects are reported back and iteratively the process is repeated until the test case passes. 
         [0040]    In a preferred embodiment of the invention, the valid test cases are selected by developer and manually checked in version management tools like Star Team and the like for future reuse and to build regression test suites. Code is checked before moving to integration/System testing. 
         [0041]    While considerable emphasis has been placed herein on the particular features of this invention, it will be appreciated that various modifications can be made, and that many changes can be made in the preferred embodiments without departing from the principles of the invention. These and other modifications in the nature of the invention or the preferred embodiments will be apparent to those skilled in the art from the disclosure herein, whereby it is to be distinctly understood that the foregoing descriptive matter is to be interpreted merely as illustrative of the invention and not as a limitation.