# Patent

## Title
Method and system for dynamic business rule extraction

## Abstract

The invention relates to a method and system for discovering and documenting the business knowledge contained in the functions of each program of existing software applications as expressed in the source code of each program using a novel method of dynamic business rule extraction that overcomes the inherent limitations of previous methods. The novelty of the method results from the deterministic relationship between program functions and the program code executed to perform each function as revealed by empirical analysis of the actual code execution, hence “dynamic” business rule extraction. This compares to previous methods which utilized a manual process, a fully automated process, and/or a process of analysis against the non-executing source code of each programs in which the analyst must infer the execution path, hence “static” business rule extraction. Furthermore, dynamic business rule extraction can deliver results without errors or omissions and document forensically that it has done so.

## Background
1 FIELD OF TECHNOLOGY
This disclosure relates generally to data processing devices and, more particularly, to a method, a device and/or a system of dynamic business rule extraction.
2 BACKGROUND
2.1 Field of the Invention
The invention relates to a method and a system for discovering and documenting the business knowledge used to originally create and subsequently amend existing software applications (a process commonly referred to as “business rule extraction” or by the acronym “BRE”) for the purpose of documentation or for the purpose of creating or deploying software applications which partially or wholly replace parts or all of the existing software application with functionality that broadly serves the same or a modified business purpose. The invention uses a novel method that overcomes the inherent limitations of previous attempts to do the same using different methods. The invention may be used to complement or replace existing methods or products.
2.2 Description of the Related Art
2.2.1 General Business Rule Extraction
When programmers create a completely new software system using traditional languages such as COBOL, C, or Java, they do so from a set of functional and non-functional requirements that specify precisely what each function must do and what each non-functional characteristic must be. Functional requirements are further specified by association with business rules that specify precisely how each such function shall perform its task. The job of the programmer is to take these requirements with associated business rules and create program source code that, when rendered into executable form, will operate in accordance with the requirements and associated business rules.
Business rule extraction reverses this programming process. Business rule extraction is the process of analyzing programming artifacts when the functional requirements (with associated business rules) and the non-functional requirements may not be known, or perhaps only known imperfectly due to errors and/or omissions. Those artifacts include (but are not limited to) program source code, database specifications, online screen layouts, user documentation, operational instructions, and the like.
Testing software is the process of observing whether an executing program's behavior conforms to those functional requirements and associated business rules. By definition, these requirements are known. Thus test cases can and will be employed to observe whether the execution of the program produces the expected results, since the expected results are known from the requirements and associated business rules (see FIG. 1).
Dynamic business rule extraction reverses the process of testing. In a novel use of a standard process, the program's behavior is used to discover and remediate errors and omissions in the knowledge of the functional requirements and associated business rules that underlay the processing of the existing program (see FIG. 2). In so doing, the problem of errors and omissions in extracted business rules from all other BRE processes is solved. Test cases will reveal errors in the extracted business rules. Coverage analysis will reveal omissions in the extracted business rules.
Both the purpose and the remediation efforts for testing and for dynamic BRE are inverted. The remediation of observed defects in behavior during the testing process will require revision to the program until its behavior correctly corresponds to the functional requirements and associated business rules. Conversely, observed errors and omissions in the understanding of the functional requirements and associated business rules will require revision to that understanding until they both fully correspond to the behavior of the program.
Business rule extraction is most frequently a purely manual process, in which the process of business analysis will include interviews with subject matter experts and other knowledgeable individuals, and a manual review of the artifacts associated with the application, including but not limited to application source codes, other machine readable information, documentation in printed and electronic form, and other non-machine readable information. This process suffers significantly from errors and omissions in the results, increasing disproportionately with the scale of the computer application software system.
Some vendors offer a fully automated business rule extraction service by analysis of the program source code which results in a form of algorithmic business rules. Because of inherent limitations on what can be inferred using program source code analysis techniques, the results suffer because logically related program code may lose those relationships. The consequence is that the results are difficult to use and contain errors and omissions which are not obvious.
There are a number of products generally available which meet the definition of static business rule extraction discussed below in section 2.2.3. These products are semi-automated and produce results which are better than manual business rule extraction and better than the automated business rule extraction, yet still suffer from errors and omissions.
The job of the business rule analyst is to take the relevant set of existing application program artifacts and work backwards from the completed program to derive the algorithmic steps associated with each function and from them infer the original statement of the business rules, including any subsequent amendments or other updates. The purpose of deriving the original business rules is for generating documentation, for use in creating a partially or wholly replacement system, or both.
It is not unusual for business analysts and others who created those original requirements to casually blur the distinction between “requirements” and “business rules.” Herein we strictly define “functional requirements” as what each function must do and the associated “business rules” as how that function shall operate. (All definitions are drawn from those documented in section 5.2, and if there is any conflict between a definition given in context and the equivalent definition in section 5.2 then the latter shall prevail.) We are concerned only with the functional requirements because only functional requirements have associated business rules. We will not further consider non-functional requirements herein.
Many of the problems associated with creating a replacement system result from ambiguities in the human language expression of these business rules, and/or errors and/or omissions in the detail of these business rules, all of which must be discovered during the course of development and testing of any planned replacement software application in order to create the desired result. Testing, which is typically based on the requirements, is by definition blind to errors and omissions in the business rules associated with those requirements. Hence, the common experience of replacing large scale existing software applications is for them to exhibit serious and potentially destructive functional defects when placed into production, even after passing what was thought to be a thorough and comprehensive set of tests. These defects lead to extended periods of time to correct as well as significant cost overruns. Latent defects, which may not occur immediately or may not be recognized immediately, will remain in the operating software application to create future problems and incur future costs.
As a consequence, the only complete, correct and unambiguous expression of the functions and business rules from a non-trivial existing software application consists of the source codes of the programs that are used to create the executable form of the programs, and which comprise that existing system.
For the same reason, any documentation associated with a non-trivial, existing software application will inevitably contain errors, omissions and ambiguities, quite possibly very significant ones. If such documentation is used for the purpose of creating new software to partially or wholly replace the existing systems, then that will lead to extended periods of time to correct in any replacement system as well as significant cost overruns in the project to create and deploy that replacement system.
Business rules associated with functional requirements are usually stated as an abstraction. The following is an example of an abstract business rule:

    a) “Do not allow the balance in the account to go below zero when processing a debit transaction.”


In the course of programming, each abstract business rule will be reduced to a series of algorithmic steps. The following is a simple example of an algorithmic business rule which is equivalent to the example abstract business rule above:

    a) Validate the incoming debit transaction by testing that all data elements with a numeric type contain numeric values, and that there are no low level technical errors in the format of the transaction
    b) Read the account record equivalent to the account number in the transaction and lock the record to prevent other concurrent updates
    c) If there is a low level technical error reading the account record, reject the transaction and exit the algorithm
    d) If the account record does not exist, reject the transaction and exit the algorithm
    e) If the account record does not show a status of “open”, reject the transaction, abort the update of the account record, unlock the record and exit the algorithm
    f) Reduce the account balance in the account record by the amount of the debit
    g) If the resulting account balance is less than zero, reject the transaction, abort the update of the account record, unlock the record and exit the algorithm
    h) Process the debit transaction, update the database, unlock the record, and exit the algorithm


There are many definitions of a “business rule” but for business rule extraction the best definition was derived by the Business Rules Group (formerly, known as the GUIDE Business Rules Project)1, which defines “ . . . a business rule expresses specific constraints on the creation, updating, and removal of persistent data in an information system.” In other words, a business rule is associated with allowing or rejecting a change of state within the persistent data store.
Business analysts and business personnel in general think of “business rules” as the abstractions, whereas programmers think of “business rules” as the algorithmic steps. Both definitions are consistent with the Business Rules Group definition. Herein, when a distinction is necessary for clarity, we shall refer to “abstract business rules” or “algorithmic business rules.” When a distinction is not necessary, we shall refer to “business rules” as meaning either one or both. The principal reason for making the distinction is that it is significantly more expensive to derive abstract business rules from the algorithmic business rules than to derive algorithmic rules and stop. Some projects will require extracting the abstract business rules while others may require only extracting the algorithmic business rules.
In general, use of the algorithmic business rules is usually sufficient when implementing a business rule management system within an existing application, or when rewriting parts or all of an existing system to preserve the existing functionality. Unless desired for documentary reasons, the extra expense of creating abstract rules is unlikely to be cost justified in these circumstances. Conversely, use of the abstract business rules is usually necessary when replacing an existing system with a commercial off the shelf package or when redesigning the existing system in some fundamental way to be followed by a new implementation of a replacement system. These are guidelines, not prescriptions or requirements.
The invention described herein is concerned with extracting algorithmic business rules without errors or omissions, which may or may not be subsequently abstracted into abstract business rules, and validating the algorithmic business rules and/or the abstract business rules as is relevant in a given instance.
Functional requirements may be associated with an event that could create a change of state in the persistent data, defined as an update transaction, or it may be associated with inquiring on data in the persistent data store, defined as a query transaction, which will not create a meaningful change of state. Therefore, where a distinction is relevant, we define the business rules associated with update transactions as “transactional business rules”.
The transactional business rules directly associated with functional requirements also depend on the concepts, entities and relationships that define both the transient and persistent data. We define these concepts, entities, attributes and relationships as “conceptual business rules” which may be used by both query transactions and update transactions. When a distinction is not relevant, we use “business rules” to include both the transactional business rules and the conceptual business rules which give meaning to the transactional business rules.
Loosely speaking, the conceptual business rules describe the data with their relationships, and the transactional business rules describe the details of the executable program instructions. This is an oversimplification but may help clarify the distinction.
There are also some programs that update the persistent data store under circumstances other than the occurrence of an event, such as a rules driven process that evaluates the contents of the database based on a difference in time or other attribute of the persistent data store. These are batch programs since they are not associated with any event such as the arrival of a message transaction. These rule driven processes are defined as “periodic batch programs”. Although these processes are not actuated by the arrival of a message transaction, because they are associated with a change of state in the database each such update of the persistent data also constitutes an update transaction, and the business rules that govern the selection of data and the decision to update that data also constitute transactional business rules.
To summarize, the relationships between requirements and business rules can be expressed as follows:

    a) Set of all requirements
    
        i) Subset of non-functional requirements
        
            (1) (No associated business rules)
        
        
        ii) Subset of functional requirements
        
            (1) Subset of query functions
            
                (a) Associated conceptual business rules
            
            
            (2) Subset of update functions (including periodic batch programs)
            
                (a) Associated conceptual business rules
                (b) Associated transactional business rules
            
            
        
        
    
    


The Business Rules Group business rule definition refers to transactional business rules which implicitly incorporate conceptual business rules, and this is the rigorous definition that we use, i.e., both transactional business rules and conceptual business rules. However, query transactions, which by definition do not create, update or remove persistent data, do utilize conceptual business rules. This finer distinction extends rather than contradicts the Business Rules Group definition.
Because of this definition, BRE always applies to update programs, even those which have a query capability as a component of their functions, but only rarely to query only programs. Analyzing the query logic in a query program or in a query component of an update program can expose a previously missed conceptual business rule, but in practice this is rarely done. Doing so is a matter of professional judgment by the project team. Many projects will analyze no query programs at all.
Returning to our example, conceptual business rules would define the “account” entity with its associated attributes such as the balance, as well as other entities which relate to the account such as the transient transaction data, the persistent history of previous transactions and the relationship among all such entities. Conceptual business rules also define reference data such as parameters that control the processing of debit transactions for this type of account and define transient data such as that used to perform the arithmetic to apply the amount of the debit transaction to the existing balance in the account.
When performing business rule extraction, the business rule analyst must first determine enough of the conceptual business rules to define the meaning of the functions to be subsequently analyzed and to create a vocabulary that can be used to analyze and describe the functions and associated transactional business rules. This is typically begun by analyzing the existing data model prior to beginning any business rule extraction.
During business rule extraction, these conceptual business rules may be extended and perhaps amended based on new discoveries during the analysis of the program(s) by whatever method. As transactional business rules are discovered within the program(s) and added to the set of identified transactional business rules, the concepts that they reference may be found to not exist within the set of identified conceptual business rules or the concepts may indicate errors or omissions within the set of conceptual business rules. If so, then the set of conceptual business rules will be extended or amended accordingly.
Transactional business rules depend on conceptual business rules to give them meaning. The conceptual business rules are universal across all functions in that they can be used anywhere within the scope of the application system. When using the invention to extract transactional business rules, errors and omissions in the understanding of the conceptual business rules become clear, so the invention applies to both conceptual and transactional business rules.
Transactional business rules are directly associated with specific functions and thus are implicitly local rather than universal. The set of transactional business rules associated with each function may be completely disjoint, partially overlap, or completely overlap the respective sets of transactional business rules associated with each of the other functions of the software application. In summary, conceptual business rules are always universal to the software application while transactional business rules could in theory be universal but typically are not.
When performing business rule extraction, the business rule analyst must determine, for each discovered function, that there is one or more associated business rules, then find and document the algorithmic steps that are the programmatic expression of each business rule. If abstract business rules are required, then the business rule analyst must also interpret those steps to recreate the original abstract expression of the business rules, but this abstraction is a distinct and separate process from deriving the conceptual business rules and the programmatic steps of the algorithmic business rules.
In the process of performing the analysis, the analyst may also discover and document previously undiscovered functions, but doing so is incidental to business rule extraction and does not enter into this description except insofar as previously unknown business rules are associated with a newly discovered function. The entire process of business rule extraction is iterative in the sense that the business rule analyst begins with what is known or thought to be known about the business rules of the system, and then refines and extends the analysis until complete.
In the process of documentation, the algorithmic and/or abstract business rules may be expressed in a human language such as English, in a pseudo-code, in a formal computer language, in a business rules language, in a business rules decision table, or in any other form which may or not may be directly executable and which may or may not preclude ambiguities in their expression.
2.2.2 Coverage Analysis
The execution of a program under conditions that allow the recording of the logic paths that are actually executed within the program is typically called code coverage analysis, test coverage analysis, test code coverage analysis, or simply coverage analysis. Coverage analysis is a technique of long standing for aiding the process of testing software programs against both functional and non-functional requirements. By the nature of software testing, the requirements are known and it is the behavior or nature of the program which is being analyzed for conformance with those requirements. All discussions of coverage analysis researched to date have related to this purpose of testing against known requirements, both functional and non-functional.
Each logical decision point in a program creates two logical pathways for subsequent execution, one in which the decision results in a true condition, and the other in which the decision results in a false condition. Coverage analysis, summed over the execution of one or more test cases, records the cumulative execution results for each decision point in a program, whether:

    a) the true logic path was executed,
    b) the false logic path was executed,
    c) both logic paths were executed, or
    d) neither logic path was executed.


The coverage analysis report may or may not report false logic path coverage if the false logic path is implicit rather than explicit.
The coverage report may or may not separately report true and false results from each component conditional statement of a compound conditional statement.
The scope of coverage reports is determined by the number of test cases used for a test execution of the program and the content of each test case. If only a single test case is used after resetting the counters used to record the execution of instructions, then only the logic associated with that one transaction will show as executed in the report. If more than one test case is executed at a time, or multiple executions without clearing the counters, then a cumulative coverage analysis report results showing the code executed by any of the test cases. If all test cases are executed then the resulting cumulative report that is produced may indicate omissions in the test cases and thereby determine additional test cases that may need to be created to meet coverage goals.
Testing against expected results is a “black box” test—do the inputs result in the expected outputs? Testers are typically not programmers, do not typically debug a program which fails conform to requirements, and typically have no knowledge of the internals of a program. Although black box testers do not typically examine the internals of the program, they may create cumulative coverage analysis reports to determine whether or not their tests have reached some specific overall coverage percentage, typically 80% or 90%. In this regard, their interest may be only in the statistics from the report, not the executable statement content.
Coverage analysis is a “white box” process, in which the internal instructions of a program are revealed to those who will utilize the resulting reports, both those statements executed and those statements not executed. When utilized for dynamic BRE, it is this white box mode in which coverage analysis is used, particularly for the single transaction coverage analysis reports.
2.2.3 Static Business Rule Extraction
All existing products and automated techniques for discovering business rules in existing programs analyze the source codes of those programs and only the source codes, i.e., the human readable program code that is translated into executable object form prior to production execution. In other words, the analysis of a program source code by existing technologies is static, meaning that there is no change in the state of the program during the analysis, hence the term “static business rule extraction” (or “static BRE” for short) to distinguish it from the invention described herein for which we use the term “dynamic business rule extraction” (or “dynamic BRE” for short).
Earlier attempts to automate business rule extraction are either fully automated or are semi-automated in which a static business rules analyst will research the source code of the existing application using an interactive analytical utility which uses parsing tools originally derived from compiler design and implementation. (See, for example, U.S. Pat. No. 6,389,588, “Method and system of business rule extraction from existing applications for integration into new applications”.)
The logic paths that are executed when the program is in use must be inferred by the static business rules analyst, since it is not actually executing. The greater the level of complexity of the program, the greater the number of ambiguities and missed interrelationships that arise in this inferencing process. The level of complexity increases disproportionately with the size of the program. Therefore, this inferencing process will be weakest in the largest, most complex, and usually most important programs within the application system.
Inferential analysis cannot by its nature eliminate all ambiguities in non-trivially complex programs. Consequently, there is no clear test or rigorous definition which a static BRE analyst can use to determine when or if they have reached 100% of the business rules to be extracted. In practice, static BRE will usually stop before identifying all of the subtle interactions among a significantly sized program's many strands of logic and the reference and transactional data that drives the logic.
This inferential approach, while a distinct improvement over the purely manual methods that preceded it, fails to capture all of the business rules in programs of non-trivial complexity and has no method for unambiguous validation of the extracted rules, resulting in both errors and omissions in the resulting business rules. The limitations of static BRE are discussed in more detail in section 2.3, as well as a description of how dynamic BRE overcomes these limitations.
Similarly, when the BRE analyst records the business rules extracted in a human language such as English, there is an opportunity for additional ambiguities to be introduced. When a programmer utilizes these expressed rules there is the opportunity for further errors of interpretation to occur. There is no clear test or rigorous definition by which a consumer of the extracted business rules can determine whether or not the resulting extraction contains errors and/or omissions, except through the method and system used by the invention.
2.3 Technical Comparison of Static and Dynamic BRE
As discussed above, testing observes whether or not the behavior of a program under test conforms to the expected behavior of known functional requirements with known associated business rules. In business rule extraction, it is the unknown or imperfectly known business rules associated with the program's functions that we seek to discover.
For dynamic BRE, the state of the program is constantly changing during the course of the analysis. In dynamic BRE we pursue our discovery by observing the behavior of a program's internal execution to expose a set of previously unknown or imperfectly known business rules, and then to validate that we have done so.
Both testing and dynamic BRE execute the program against test cases, but with different purposes and different outcomes. With testing we know the functions and business rules but the behavior is uncertain. Conversely, with dynamic BRE we stipulate that the behavior of each program is correct and seek to discover the unknown or imperfectly known business rules that are associated with the program's functions.
The problems of static BRE that dynamic BRE seeks to overcome are the ultimately ambiguous results from the inferential analysis of the program source codes which leads to errors and omissions in the results, and the lack of any clear and rigorous test by which an analyst can judge that their analysis is complete. Dynamic BRE provides a solution for both shortcomings of static BRE, and is fully scaleable to 100% of the business rules which static BRE is not, for programs of significant size and complexity.
Dynamic business rule extraction utilizes a novel method to eliminate these ambiguities and provide 100% of business rules and furthermore document forensically that it has done so. The invention utilizes coverage analysis in a novel way and for a novel purpose in order to solve the very real business problems created by these shortcomings in static BRE.

    a) The novelty of the coverage analysis usage with dynamic BRE is that we prepare single transaction test cases and then create a coverage analysis report showing only the lines of source code executed by each single test case.
    b) While historically coverage analysis has always been associated with testing, i.e., where the business rules are known and the behavior of the program is uncertain, the novelty of the purpose is that it is being applied to reverse the usual paradigm: to discover the business rules that are unknown or imperfectly known. In doing so it allows the solution to both shortcomings of static BRE.


The invention is based on analyzing the actual execution path during execution against actual data of the compiled object code version of the source code as opposed to the inferred execution during static BRE against data imagined by the static BRE analyst. The object code actually executed with coverage analysis is linked back to the source code so that the dynamic BRE analyst sees a report showing the source code that was and was not executed. Analysts using each method work from the source code, but the dynamic analysis is based on deterministic program code execution while the static analysis is based on inferential program code execution.
Coverage analysis is used in two ways during dynamic BRE:

    a) The single transaction coverage analysis report is utilized to discover the business rules associated with the single transaction test case with its unique set of data conditions. This solves the inferential problem with static BRE by enabling a fully deterministic analysis.
    b) The cumulative coverage analysis report resulting from the sequential execution of all test cases for a given program is used to determine whether we have achieved 100% coverage in our set of all test cases. This second report solves the problem of static BRE not having a clear and rigorous definition of completion. This report also provides the forensic documentation that the extracted set of business rules are complete, for audit traceability purposes.


A second method of following the program execution could be through the use of an interactive debugger. These utilities provide the ability to not only follow the logic paths actually executed by the program under test, just as is provided by the single transaction coverage analysis reports, but also provides the ability to stop and examine or even modify the values of data variables in memory during the course of code execution for an even deeper understanding, which is not provided by the coverage analysis report. However, this method is so labor intensive and time consuming that it is impractical to use except under rare circumstances. This is an adjunct utility to use in special cases when the single transaction test cases have a scope of execution that is greater that which is desired to reveal the detailed actions of the executing business rules.
The invention also optionally allows for the creation of a Business Rule Execution Path Report which records additional details from the execution to use for an extended analysis in circumstances for which the use of an interactive debugger might otherwise be considered. While this report can frequently be voluminous, it is significantly more efficient for the purpose of eliciting these fine details than an interactive debugger. Among other things, one can back up during analysis of the recorded information, whereas most implementations of interactive debuggers do not allow one to do so.
Completion of dynamic business rule extraction is defined as 100% of the logic paths in the program being executed or explained, either as not being able to be executed or why it is not necessary to execute that logic path. A more complete discussion of explained logic paths is given in the detailed description in section 5.7.
Furthermore, in contrast to static BRE, dynamic BRE can objectively determine whether or not the extracted business rules are valid, as well as documenting forensically that it has done so. We validate the extracted business rules when we take the test cases developed in the process of dynamic BRE against the existing programs, adapt the data and transactions from those tests to the formats used in any replacement system, and execute them against the functionally equivalent modules in the replacement system, thus proving empirically that they are valid by demonstrating equivalence. In other words, during dynamic BRE validation we demonstrate that the reproduced business rules constitute the complete set of business rules without errors or omissions.
The coverage reports created by the execution of the test cases against the existing programs and against the replacement system's program(s) creates the forensic documentation.
This use of test cases derived from the existing program(s) against the replacement program(s) is both novel and non-obvious. Testers develop test cases based on requirements, so that the testers work from the documented functional requirements and documented associated business rules. If these contain ambiguities of expression then the test cases themselves can be as potentially defective as the replacement program(s) themselves, assuming they were built against the same ambiguously expressed functional requirements and associated business rules. Only the machine readable test cases that were validated against the existing program(s), correctly adapted to the replacement program(s), can reliably validate the implementation of the reproduced functions and associated business rules.
Each single update transaction test case executed against a program's replacement reveals any errors or omissions in the documentation of extracted business rules, in the interpretation of those documented business rules, and/or in the implementation of the replacement program. The coverage analysis report from the existing program that accompanies the test case and the coverage analysis report from the equivalent test execution against the replacement program also provides rapid and efficient diagnosis of any observed defect in the replacement program in which it failed to function equivalently.
The cumulative set of update transaction test cases executed against a program's replacement is expected to show 100% of the logic paths executed, since the explained logic paths from the existing programs are not carried forward to a replacement program. If any logic paths are not executed in the replacement, they need to be examined to see if they are the result of technical logic which does not impact the results of the program's execution. However, if there are unexecuted logic paths after excluding technical logic which does impact the results of processing, then they have to be analyzed to determine whether they constitute erroneously or maliciously added business rules.
Dynamic BRE can be used in place of static BRE, or as a complement to static BRE. Dynamic BRE deals with one program at a time, but does so to a greater depth than can usually be achieved by static BRE. However, the one advantage of static BRE is that it can search among all the source codes of the system for business logic associated with specific data conditions. This can be desirable in the situation where a given set of business rules is used in multiple locations in a single program and/or across multiple programs, but the implementation uses subtly different expressions of the rules that, under certain circumstances, can give rise to a different result. Static BRE can thus identify multiple locations where the dynamic BRE analysis needs to focus in order to explore the similarities and differences among the multiple implementations. This is useful and so, in general, one might expect to see static BRE complementing dynamic BRE more often than using dynamic BRE by itself.










Summary of Comparisons Between Use of Coverage Analysis for


Testing and Use of Coverage Analysis for Dynamic Business Rule


Extraction To Demonstrate Novel Use











Dynamic Business


Usage
Testing
Rule Extraction





Usage of
Single transactions are
Single transaction coverage


single
typically used to test the
reports provide the primary


transaction
results against known
method of observation of the 


coverage
expected results from those
behavior of the program for


analysis
data conditions. Coverage
dynamic BRE purposes. They



analysis is used only with
are used to determine the



regard to the percentage of
logic paths executed by that



program code covered. The
transaction and thereby lead



internals are typically never
to discovery of unknown or



examined by testers.
imperfectly known functional




requirements and associated




business rules and/or of 




errors and omissions in the




functional requirements and




associated business rules.


Usage of
Cumulative coverage analysis
Cumulative coverage


cumulative
is typically used to determine
analysis is used to


transaction
whether or not testing
determine whether or not


coverage
has reached a pre-defined
there are remaining potential


analysis
threshold of coverage.
omissions in the business rules



(Testing is typically
(i.e., logic paths neither



halted prior to 100%.)
executed nor explained)?



















Summary of Technical Comparison of Static and


Dynamic Business Rule Extraction










Static BRE
Dynamic BRE





State of program
Static
Dynamic


Analytical device
Analysis of
Analysis of source code with



standalone
actual execution path information



source code
recorded by the executing



with parsers
program code against data.


Execution path
Inferred
Actual


Data driving the
Imagined
Actual


execution




Type of analysis
Inferential
Deterministic


Objective measure
No
Yes


of completion




Unambiguous
No
Yes


validation of correct




business rule




extraction




Use of single test
N/A
Illuminating logic paths executed 


case coverage

for each update transaction against


analysis with

existing program for business


existing programs

rule discovery and extraction


Use of cumulative
N/A
Determining completeness of


test case coverage

analysis and revealing potential


analysis with

omissions in the business rules


existing programs




Use of single test
N/A
Test cases validated against


case coverage

existing programs when adapted


analysis with

for replacement programs


replacement

which are subsequently executed 


programs

reveal errors or ambiguities




in business rule documentation,




interpretation and/or implementation. 




Coverage report aids debugging




by comparison with coverage




report from existing program.


Use of cumulative
N/A
Identifies added business rules


test case coverage

that may be the result of potential


analysis with

programming errors or


replacement

potential malicious coding.


programs




Scope of analysis
One or more
One program at a time



programs




at a time









2.4 Economic Comparison of Static and Dynamic BRE

Because dynamic BRE analyzes to a greater depth, it might be thought to be more expensive than static BRE covering the same programs. However, by our analysis, dynamic BRE is a bargain:

    a) only the programs updating the persistent data store will be analyzed, which are typically 10-30% of the programs in an application suite of programs;
    b) the cumulative coverage analysis test cases used for business rule validation and completeness also cover unit testing for the new application, eliminating that cost;
    c) the replacement application can be expected to go into production with no discrepancies in the functioning of the business rules, an unheard of level of accuracy which eliminates what can be very considerable last stage costs for finding and debugging discrepancies in pre-production testing or in production operation.


The set of transactional and conceptual business rules associated with any one given function interacts among all the other sets of business rules associated with their respective functions to various degrees. The result is that the effort to extract each next business rule increases as the analysis proceeds. The larger the program the more business rules will be contained therein to discover and extract, and therefore the more this increasing effort impacts the overall effort for that program. These business rule interactions among each other as well as interactions among the various values of parameter data result in a degree of complexity and ambiguity that increasingly impacts any static business rule extraction project as the scale of the application increases. Eventually even the best and brightest business rule analyst will become progressively bogged down in the analysis, as sooner or later this escalating complexity will exceed any human's capability to hold in one's mind.
When using static BRE in projects, we have observed a relationship between the percentage of active business rules actually extracted as a function of effort expended that has approximately the shape of a classic diminishing returns curve (see FIG. 3).
There is a point of diminishing returns beyond which deriving business rules completely and correctly using static BRE from programs of non-trivial complexity becomes impossible in practice, and economically prohibitive. This point is reached at a different scale depending on the language, the implementation standards, and the degree to which the comprehensibility of a given application has degraded over its lifetime due to a large variety of factors, such as for example being maintained by multiple programmers each with different levels of competence and with different programing styles.
Regardless of precisely where the point of diminishing returns is located for a given program, all software programs of non-trivial complexity are subject to this problem of scale forcing static business rule analysis to halt prior to reaching the ideal goal, i.e., providing a 100% complete and correct set of business rules for each functional requirement. The resulting errors and omissions in the business rules of a replacement program show up as defects in the new software application, and can result in delays in deployment that can significantly increase costs and even, in extreme cases, result in project failure. Worse is the situation where the new application goes into production deployment with numerous undetected defects in the business rules. The cost of program and data repair when the system is in production is much, much greater than had the defect been detected at the outset of the new implementation.2 2 For one example, see Michael Lundblad and Moshe Cohen—IBM, March, 2009. Software quality optimization: balancing business transformation and risk.
Dynamic business rule extraction is also subject to diminishing returns but to a significantly lesser extent because

    a) any residual ambiguities in understanding can be resolved by using an interactive debugging utility to step through the execution instruction by instruction until the ambiguities are resolved empirically or by using the Business Rule Execution Path Report, and
    b) because we have an objective standard that defines when the business rule extraction effort is complete. “Complete” is defined to mean having analyzed 100% of the logic paths through the program(s) under analysis from the existing software application. In this case, “analyzed” means either by creating a test case with data conditions that force the program to execute that logic path or by explaining why it is not possible or necessary to execute that logic path.


3 SUMMARY
Disclosed are a method, a device and/or a system of dynamic business rule extraction.
In one aspect, the invention allows the user to record and subsequently examine the logic paths executed by an existing program to discover the business rules executed as a result of a transaction and/or of other circumstances that result in a change of state of the persistent data store.
In another aspect, the invention allows the user to examine the deterministic execution of an existing program to discover whether or not all active business rules have been identified.
In another aspect, the invention documents forensically that all active business rules have been identified and that all other business rules have been explained as to why they are not active, so that full traceability is established.
In another aspect, the business rules so extracted may be algorithmic business rules only or algorithmic business rules plus abstract business rules.
In another aspect, the program is analyzed for program source code statements containing business rules using an interactive coverage analysis report.
In another aspect, the logic paths can be annotated with information that is persisted across multiple executions of the program under analysis, and which can be aggregated and analyzed across multiple programs for statistical analyses and other purposes.
In another aspect, the coverage analysis of false branch logic paths occurs under all forms of expression of conditional statements, both explicit and implicit.
In another aspect, the coverage analysis of all conditional components of all compound conditional statements occurs for all compound conditional statements.
In another aspect, an execution path report can be prepared to provide additional detail on the execution of specific statements.
In another aspect, a static business rule extraction utility can be used in conjunction with dynamic business rule extraction to provide complementary capabilities.
In another aspect, the business rules so extracted, whether they be algorithmic business rules only or algorithmic business rules plus abstract business rules, may be validated to discover any errors or omissions in the documentation and/or interpretation and/or re-implementation of those extracted business rules.
In another aspect, any replacement program(s) incorporating the extracted business rules can discover any erroneously or maliciously added business rules.
The methods and systems disclosed herein may be implemented in any means for achieving various aspects, and may be executed in a form of a non-transitory machine-readable medium embodying a set of instructions that, when executed by a machine, cause the machine to perform any of the operations disclosed herein. Other features will be apparent from the accompanying drawings and from the detailed description that follows.



4 BRIEF DESCRIPTION OF THE DRAWINGS
The embodiments of this invention are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements and in which:
FIG. 1 shows the relationship between functional requirements with associated business rules when testing a program prepared with those requirements and business rules.
FIG. 2 illustrates the inverted relationship between functional requirements with associated business rules when performing dynamic business rule extraction.
FIG. 3 is an illustration of the diminishing returns relationship between the percentage of business rules extracted using static business rule extraction and the effort of doing so.
FIG. 4 is a small sample of an interactive code coverage report with a monochrome illustration of the color coding provided to the user to highlight areas of attention required. In this case the user is presented with 3 unexecuted logic paths.
FIG. 5 is an update of FIG. 4 in which additional test results have caused 2 of the 3 unexecuted logic paths to be executed, leaving 1 unexecuted logic path for analysis.
FIG. 6 is an update of FIG. 5 in which an explanation is given of why that logic path does not need to be executed.



Other features of the present embodiments will be apparent from the accompanying drawings and from the detailed description that follows.
5 DETAILED DESCRIPTION
Example embodiments, as described below, may be used to provide a method, a device and/or a system of dynamic business rule extraction.
The detailed description set forth below in connection with the appended drawings is intended as a description of various configurations and is not intended to represent the only configurations in which the concepts described herein may be practiced. The detailed description includes specific details for the purpose of providing a thorough understanding of various concepts. However, it will be apparent to those skilled in the art that these concepts may be practiced without these specific details. In some instances, well known structures and components are shown in block diagram form in order to avoid obscuring such concepts.
Although the present embodiments have been described with reference to specific example embodiments, it will be evident that various modifications and changes may be made to these embodiments without departing from the broader spirit and scope of the various embodiments. It is to be understood that the specific order or hierarchy of steps in the methods disclosed is an illustration of exemplary processes. Based upon design preferences, it is understood that the specific order or hierarchy of steps in the methods may be rearranged. The accompanying method claims present elements of the various steps in a sample order, and are not meant to be limited to the specific order or hierarchy presented unless specifically recited therein.
The previous description is provided to enable any person skilled in the art to practice the various aspects described herein. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. Thus, the claims are not intended to be limited to the aspects shown herein, but are to be accorded the full scope consistent with the language of the claims, wherein reference to an element in the singular is not intended to mean “one and only one” unless specifically so stated, but rather “one or more.” Unless specifically stated otherwise, the term “some” refers to one or more. A phrase referring to “at least one of” a list of items refers to any combination of those items, including single members. As an example, “at least one of: a, b, or c” is intended to cover: a; b; c; a and b; a and c; b and c; and a, b and c. All structural and functional equivalents to the elements of the various aspects described throughout this disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims. Moreover, nothing disclosed herein is intended to be dedicated to the public regardless of whether such disclosure is explicitly recited in the claims. No claim element is to be construed under the provisions of 35 U.S.C. §112, sixth paragraph, unless the element is expressly recited using the phrase “means for” or, in the case of a method claim, the element is recited using the phrase “step for.”
The various devices and modules described herein may be enabled and operated using hardware circuitry (e.g., CMOS based logic circuitry), firmware, software or any combination of hardware, firmware, and software (e.g., embodied in a non-transitory machine-readable medium). For example, the various electrical structure and methods may be embodied using transistors, logic gates, and electrical circuits (e.g., application specific integrated (ASIC) circuitry and/or Digital Signal Processor (DSP) circuitry).
5.1 Definition of the Invention
The invention is a software device for discovering 100% of the active business rules that control the functions of a given program which is a proper or improper subset of a computer software application system's set of constituent programs, and documenting forensically that it has done so, using the method of coverage analysis.
5.2 Definitions











Word or Phrase
Definition or Usage Herein







[noun](s)
Any reference to any noun X in the form of “X(s)” is



defined to be read as meaning “one or more X's”.


“functional
specify precisely what each function must do;


requirements”
functional requirements are further specified by



association with business rules that specify precisely



how each such function shall perform its task.


“non-functional
specify precisely what each non-functional


requirements”
characteristic must be.


“business rule”
expresses specific constraints on the creation, updating,



and removal of persistent data in an information



system.


“transaction”
is one element from a set of transient data.


“transaction(s)”
is defined as one or more transactions.


“query
is defined as transaction(s) which when


transaction(s)”
processed by program(s) will not change the state



of the database.


“update
is defined as transaction(s) which when


transaction(s)”
processed by program(s) may change the state



of the database.


“conceptual
The set of conceptual business rules collectively


business rules”
define the concepts, entities, attributes and 



relationships among the data, from which is derived



the vocabulary of the application. Conceptual 



business rules are associated with both query 



and update transactions, and include calculations



and data movement aspects of any update transaction.


“transactional
A transactional business rule expresses one or more


business rule”
specific constraints on the creation, updating,



and removal of persistent data in an information



system by an update transaction. A transactional



business rule is expressed in terms of the concepts, 



entities, attributes and relationships from the 



conceptual business rules. Transactional business



rules are associated only with update transactions.


“abstract
Business rules expressed in a general form which is


business
not concerned with a specific implementation


rules”
of those rules.


“algorithmic
The step by step sequence of instructions required to


business rules”
execute a business rule as would be expressed in



some procedural language source code.


“hypothesis”
As used herein in the context of business rules, a 



hypothesis is what is thought to be known about a



specific business rule, and may be used as the



basis for creating test cases to confirm, refute



or amend the hypothesis.


“program”
as used herein is defined as referring to any complete 



set of executable computer commands which may be



expressed in any form, and which may include (but is



not limited to) any sub-programs, executable logic



defined in a database of any kind, executable



logic defined in a business rule management



system, executable logic controlled by stored data,



and/or any other executable component that can



be controlled by the author or authors of the program.


“mainline
is a program which contains the entry point into the


program”
program required to initiate execution of the program



by any component of the operating system of the



computer. A “sub-program” is a program which



is not initiated by any component of the



operating system of the computer.


“program(s)”
is defined to mean either a single program or a set of



programs.


“source code” 
is the human readable set of computer commands which


of a program
define the executable logic of the program.


“object code” 
is the set of computer commands which comprise the


of a program
executable logic of the program and which has been 



created by any means from the source code; it is typically 



but not always in a non-human readable form.







Any given program can be categorized as follows whether executed


interactively or in batch:








“query 
is defined as a program whose execution will not 


program”
change the state of the database.


an “update
is defined as a program whose execution may change


program”
the state of the database. Update programs are defined



as falling into one of three sub-categories:


“periodic
is defined as an update program whose execution may


batch”
change the state of the database without the input of any


program
transient data.


“transactional
is defined as an update program whose execution may


batch”
change the state of the database using 


program
batch transaction(s).


“interactive”
is defined as an update program whose execution may


program
change the state of the database using interactive



transaction(s).


“database”
is defined as the complete set of persistent data that can



be queried and/or updated by program(s) including one



or more instances of one or more database management



systems and/or indexed data files and/or randomly



accessed data files and/or sequential data files



and/or any other relevant data stores.


“transient data”
is defined as any data which is not persisted to permanent



storage in a database and may include messages and/or



records from data files which will be processed by



program(s) in order to change the state of a database or



to query data from a database.


“production
is a database which contains the data used to fulfill the


database”
operational purpose of the program(s).


“test”
is the process of exercising the executable logic of



program(s) to determine whether the behavior of the



program(s) produces the results that are expected.


“test database”
is a database which contains the data used to 



test program(s), but which is not used to fulfill the



operational purpose of the program(s). 



A production database may be used as a test



database if the updated database is not used to



fulfill the operational purpose of the program(s).


“baseline
is a test database which has been validated to demonstrate


database”
that it can be repeatedly reloaded and a consistent set of



programs executed in an identical manner to give the



identical results each time.


“interactive
refers solely to transaction(s) received as message(s)


transaction(s)”



“batch
refers solely to record(s) from a file of transaction(s).


transaction(s)”



“periodic batch
is a test database in a specific state such that when


test case”
processed by periodic batch program(s) will produce



an expected result.


“transactional
is a test database in a specific state plus transient data


test case”
such that when the transient data is processed by



transactional batch program(s) or interactive



program(s) will produce an expected result.


“test case”
either a periodic batch test case or a transactional test



case.


“atomic test
is a test case prepared such that it represents


case”
the smallest possible execution, typically a single



transaction for a transactional test case and the



smallest change in the state of the database which is



practical for a periodic batch test case.


“cumulative
the summation of all atomic test cases, i.e., the initial


test cases”
set of test cases as augmented over time with



additional atomic test cases.


“test data”
a test database and one or more periodic batch test cases



and/or one or more transactional test cases.


“all test data
the collection of the baseline test database, all test 



cases, and the test database backup after



execution of all test cases.


“test data team”
is defined as an individual or team separate from the



business rule analyst which is authorized to



create test data.


“instru-
the process by which program(s) have new source code


mentation”
records inserted into their source codes and/or have



existing source code records modified and/or have



existing source code records deleted according to



pre-programmed rules. “Instrument” is the transitive



verb form of instrumentation.


“instrumented 
consists of the new source records inserted and/or the


logic”
existing source records modified and/or the existing



source records deleted during the process of 



instrumentation.


“instru-
consist of the pre-programmed rules which control the


mentation
source code insertion and/or modification


rules”
and/or deletion.


“coverage
“coverage analysis”, “code coverage”, “code coverage


analysis”
analysis”, “test code coverage”, “test code coverage



analysis” and other variations should be understood to



refer to precisely the same process, that there is no



meaningful distinction among them, and that they can



be used interchangeably without ambiguity.


“coverage
the process by which the coverage analysis module of the


analysis
invention will instrument the program(s) with functionally


instru-
neutral, diagnostic logic that records the logic pathways


mentation”
within the program that are actually executed by the test



data presented to the program at execution time.



Optionally, the instrumented logic inserted by the



coverage analysis module of the invention ensures



the recording of both the true logic path and



the false logic path whether or not there is an



explicit “ELSE” condition contained within the 



program source code for the logical test in question.



Optionally, the instrumented logic inserted by the



coverage analysis module of the coverage



analysis module of the invention records



whether or not each element of a compound



conditional expression has been tested.


“reference
is defined as the minimal reproduction of the existing


imple-
business rule functionality only, usually in the language


mentation”
and execution environment desired for the replacement



application. A reference implementation needs only the



update transactions reproduced for validation purposes.



Query transactions, reports, analytics, a user interface and



other non-essentials are not required. If planned properly,



the reference implementation can form the nucleus



of a new implementation.









5.3 Dynamic Business Rule Extraction Process
The dynamic business rule extraction process proceeds in one of two ways depending on whether the goal is only algorithmic business rules or algorithmic and abstract business rules. For the indicated form of business rules desired, it is employed in the following step by step manner for each program from which business rules are to be extracted. When the steps are the same for both processes, the step for algorithmic and abstract business rules is indicated as “(same)”. When a step applies only to one process, the other entry for that step is “(not applicable)”. Although the process is described sequentially for clarity, in practice many steps are independent and those may be performed in parallel or in a different sequence.













Step
Stage
Algorithmic Rules Only
Algorithmic and Abstract Rules


















1.
Preparation
Preparation stage begins.
(same)


2.
Preparation
Determine who is authorized to
Determine who is authorized




create test data. Test data
to create test data. Test data




may be prepared by the
should be prepared by the




business rule analyst or by
test data team, not by the




anyone else designated to do so.
business rule analyst.


3.
Preparation
Create baseline database. A test
(same)




database must be created and





validated as being a baseline





database. The baseline database





can be based on the production





database, existing test





database(s), newly created data,





any other database, or a combination.



4.
Preparation
Create date independent test
(same)




environment. If any logic in the





program(s) is date dependent,





then the test operational





environment and/or logic in the





program(s) must be modified





so that they can be re-executed





at any time with the date set to





the date at which the baseline





database was validated or to





any other specific date required





for test cases. For the greatest





productivity, this should be a





virtualized environment.



5.
Preparation
Secure baseline database. This
(same)




validated baseline database





must be secured such that it can





be restored at any time. It is





recommended that multiple





copies be made that are secured





from possible deletion and





distributed to backup locations.



6.
Preparation
Define test and backup
(same)




procedures. The test procedure





must allow the baseline





database to be reloaded and all





tests executed in a completely





repeatable manner at any time.





Backup of the test database and





other data at other restore





points in the process is optional.



7.
Preparation
Define inventory of programs
(same)




for business rule extraction. All





update programs must have





their business rules extracted.





Query programs may follow





this process if there are





conceptual business rules





uniquely represented therein,





but otherwise query programs





are excluded from this process.



8.
Preparation
Define initial test database
(same)




according to the program(s)





under test. The initial test





database for the program(s)





under test will consist of the





baseline database, plus any data





modifications that might be





required for the subsequent test





cases according to analyses





regarding the data conditions





that are expected a priori to





force the program to execute all





active logic paths.



9.
Preparation
Define initial test cases
Define initial test cases for the




according to the program(s)
program(s) under test. An initial




under test. The initial set of test
set of abstract business rules




cases for program(s) under test
must be created from business




will consist of one or more
analysis or any other source,




atomic test cases which have
and used to create an initial set




been prepared according to
of test cases for the program(s)




analyses regarding the data
under test. Each test case




conditions that are collectively
should be linked to the abstract




expected to force the
business rule from which it was




program(s) to execute all active
derived. It is recommended that




logic paths at least once. They
the initial set of test cases




may be created as new data,
should not be derived from




from production data, from
production operations or from




existing test data, or a combination.
existing test cases.


10.
Preparation
Instrument program inventory
(same)




for coverage analysis. If the





program(s) is(are) not written





in a language that requires





instrumentation to implement





coverage analysis, this step





may be skipped. The coverage





analysis module of the





invention instruments the





program(s) from which





business rules are being





extracted. The instrumented





logic consists of functionally





neutral, diagnostic logic that





records the logic pathways





within the program(s) that are





actually executed by the test





data presented to the program





at execution time.



11.
Preparation
Instrument any relevant
(same)




individual programs from the inventory 





to record the sequence of logic paths





executed to produce a





subsequent Business Rule





Execution Path Report. The





coverage analysis module of





the invention instruments the





program(s) from which





business rules are being





extracted using an alternate set





of instrumentation logic. The





alternate instrumentation logic





consists of functionally neutral,





diagnostic logic that records





the sequence in which the logic





pathways within the program(s)





are actually executed by the





test data presented to the





program at execution time.



12.
Preparation
Compile instrumented
(same)




coverage analysis program(s).





If the program(s) is(are) not





written in a language that





requires instrumentation to





implement coverage analysis,





or if the language does not





require compilation, then this





step may be skipped. The





instrumented version of the





program(s) is compiled and





link edited, or otherwise





prepared for execution





according to the technical





requirements of the





program(s)'s run time environment.



13.
Preparation
Compile instrumented
(same)




execution path program(s). If





the language in which the





program(s) is(are) written does





not require compilation, then





this step may be skipped. The





instrumented version of the





program(s) is compiled and





link edited, or otherwise





prepared for execution





according to the technical





requirements of the





program(s)'s run time environment.



14.
Preparation
Preparation stage ends.
(same)


15.
Execution
Execution stage begins.
(same)


16.
Execution
Reload baseline database.
(same)




Reset the database to its initial state.



17.
Execution
Reset cumulative coverage
(same)




analysis totals. Execute the





coverage analysis utility of the





invention to zero out the





cumulative coverage analysis statistics





for the program(s) being executed.



18.
Execution
Atomic test case execution.
(same)




The program is executed





against a single atomic test





case, with the coverage





analysis logic creating an





output file containing the





recorded logic path information





for that single test. This output





file is used to create a new





Business Rule Coverage





Analysis Report showing only





the logic executed from the





atomic test case.



19.
Execution
Cumulative test cases
(same)




execution. The program is





executed again against the set





of cumulative test cases except





for the single atomic test case





just processed, with the





coverage analysis logic





creating an output file





containing the recorded logic





path information which is





cumulative over all atomic test





cases. This output file is used





to create a new Business Rule





Coverage Analysis Report





showing the cumulative logic





executed across all the atomic





test cases, or to update a





previously created Business





Rule Coverage Analysis





Report, preserving all annotations.





This step is skipped after the





first atomic test case execution





because no other test cases will





have accumulated.



20.
Execution
Execution stage ends.
(same)


21.
Analysis
Analysis preparation stage begins.
(same)



preparation




22.
Analysis
Create the atomic Business
(same)



preparation
Rule Coverage Analysis





Report. The output file from





step 18 is consumed by the





analysis module of the





invention, which creates a





Business Rule Coverage Analysis





Report solely for the atomic test.



23.
Analysis
Create the cumulative Business
(same)



preparation
Rule Coverage Analysis





Report. The output file from





step 19 is consumed by the





analysis module of the





invention, which creates the





Business Rule Coverage





Analysis Report after the first





execution of step 19 or updates





it after any subsequent execution(s)





of step 19. This step is executed 





only if step 19 is executed.



24.
Analysis
Analysis Preparation stage ends.
(same)



preparation




25.
Analysis
Analysis stage begins.
(same)


26.
Analysis
Atomic test case analysis. The
(same)




atomic Business Rule Coverage





Analysis Report is examined to





extract the business rules from the 





source code associated with the program





executed by the atomic test case.



27.
Analysis
Determination of 100%
(same)




coverage. The cumulative





Business Rule Coverage





Analysis Report summary is





examined to determine whether





any remaining unexecuted and





unexplained logic paths remain





in the program. When all logic





paths are either executed or





explained, the process proceeds





to step 33 for validation of





results. If unexecuted or unexplained





logic paths remain in the program,





then the analysis continues.



28.
Analysis
Explanation of unreachable
(same)




logic paths. The logic paths not





executed and not explained are





examined to determine whether





or not each such logic path is





executable or unreachable, and





if any are unreachable then





each such path will have the





unreachable explanation reason





entered into the interactive





Business Rule Coverage





Analysis Report.



29.
Analysis
Explanation of unexecuted
(same)




logic paths. Any remaining





logic paths not executed and





not explained are examined to





determine whether they can be





explained, and if so then the





explanation reason is entered





into the interactive Business





Rule Coverage Analysis Report





for all such explainable logic paths.



30.
Analysis
Determination of 100%
(same)




coverage. The Business Rule





Coverage Analysis Report





summary is examined again,





after entering explanations, to





determine whether any





unexecuted and unexplained





logic paths remain in the





program. When all logic paths





are either executed or





explained, the process proceeds





to step 33 for validation of





results. If unexecuted or





unexplained logic paths remain





in the program, then the





analysis continues.



31.
Analysis
Revision or extension of test
Revision or extension of test




data. The logic paths not
data. The logic paths not




executed are examined to
executed are examined and the




determine the data conditions
abstract business rule




that will force their respective
hypotheses revised and/or




executions, and extracted
deleted, and/or new abstract




business rules revised as
business rule hypotheses




appropriate in light of the new
created as the business rule




information. The test data will
analyst seeks to expand the




be revised accordingly to create
number of logic paths covered




those data conditions, and the
by the test execution. The




process returns to step 18 for
revised business rule




one or more additional
hypotheses are documented to




executions of revised or new
the test data team so that the




atomic test cases or to step 19
test data can be revised




for an additional execution of
accordingly. The process




the program against the revised
returns to step 18 for one or




cumulative test data, as is
more additional executions of




appropriate based on the analysis.
revised or new atomic test cases





or to step 19 for an additional





execution of the program





against the revised cumulative





test data, as is appropriate based





on the analysis.


32.
Analysis
Analysis stage ends, The
(same)




execution and analysis steps





continue iteratively until all





logic paths in the program have





been executed or explained, at





which time the validation





stages can proceed.



33.
Validation
Validation preparation stage
Validation preparation stage



preparation
begins. The validation stages
begins. The validation stages




validate the reproduction of the
validate the reproduction of the




extracted algorithmic business rules.
extracted abstract business rules.


34.
Validation
Build replacement program(s).
Build reference



preparation
When the business rules are
implementation. When the




reproduced in replacement
business rules are reproduced in




program(s), they are likely to
the reference implementation,




suffer from errors and
they are likely to suffer from




omissions in the reproduced
errors and omissions in the




application, as well as errors
expression of the business rules,




and omissions due to
as well as errors and omissions




mis-interpretation of the
due to mis-interpretation of




documented business rules.
business rules documented. The




The reproduced application
reference implementation can




must be directly equivalent to
become the nucleus of a new




the existing application, or can
application after validation.




be equivalently mapped.



35.
Validation
Convert test data. The baseline
Convert test data. The baseline



preparation
database and all test data must
database and all test data must




be mapped to the reproduced
be mapped to the reference




application and converted
implementation and converted




appropriately.
appropriately.


36.
Validation
Automate validation test
(same)



preparation
executions. It is recommended





that all test cases be executed





using test automation tools and





techniques, including interactive tests.



37.
Validation
Prepare to discover any newly
(same)



preparation
introduced business logic. The





replacement program(s) is(are)





prepared for coverage analysis





using instrumentation or





otherwise as appropriate for the





language and run time environment.



38.
Validation
Validation preparation stage
(same)



preparation
ends.



39.
Validation
Validation execution stage
(same)



execution
begins.



40.
Validation
Execute validation tests. The
Execute validation tests. The



execution
test cases must be executed
test cases must be executed




against the reproduced
against the reference




application.
implementation.


41.
Validation
Execute comparison of results.
Execute comparison of results.



execution
The results of executing the
The results of executing the




reproduced application must be
reference implementation must




compared against the results of
be compared against the results




execution from the existing
of execution from the existing




program(s). This means, at a
program(s). This means, at a




minimum, that the test database
minimum, that the test database




backed up after execution of all
backed up after execution of all




test cases from the existing
test cases from the existing




application must be
application must be




automatically compared for
automatically compared for




equivalence with the new test 
equivalence with the new test




database.
database.


42.
Validation
Validation execution stage
(same)



execution
ends.



43.
Validation
Validation analysis stage
(same)



analysis
begins.



44.
Validation
Analyze results of comparison.
Analyze results of comparison.



analysis
If all of the tests produce
If all of the tests produce




identical or functionally
identical or functionally




equivalent results, then the
equivalent results, then the




analysis confirms that all
analysis confirms that all




algorithmic business rules were
abstract business rules were




reproduced correctly. If not,
reproduced correctly. If not,




then the cause of the
then the cause of the




discrepancies must be
discrepancies must be




diagnosed and all discrepancies
diagnosed and all discrepancies




resolved, followed by
resolved, followed by




re-executing the test cases
re-executing the test cases




against the replacement
against the reference




application program(s).
implementation program(s).


45.
Validation
Analysis for newly introduced
Analysis for newly introduced



analysis
business logic. The cumulative
business logic. The cumulative




coverage analysis reports for
coverage analysis reports for




each of the replacement
each of the reference




application's program(s) is(are)
implementation's program(s)




analyzed. If all logic paths in
is(are) analyzed. If all logic




those program(s) are executed
paths in the program(s) are




by the cumulative test cases,
executed by the cumulative test




then the replacement
cases, then the replacement




application has been
application has been




demonstrated to have an
demonstrated to have an




equivalent range of
equivalent range of




functionality. However, if there
functionality. However, if there




are logic paths not executed by
are logic paths not executed by




this set of tests, then those logic
this set of tests, then those logic




paths can be examined to see
paths can be examined to see




whether they represent program
whether they represent program




development errors, technical
development errors, technical




logic or possibly malicious
logic or possibly malicious




code introduced into the
code introduced into the




programs. This is the only
programs. This is the only




mechanism by which such
mechanism by which such




possibly malicious code can be
possibly malicious code can be




exposed in a rigorous and
exposed in a rigorous and




comprehensive manner.
comprehensive manner.


46.
Validation
Validation analysis stage ends.
Validation analysis stage ends.



analysis









5.4 Validating 100% Business Rule Extraction
Proper use of the above process with the invention will result in a set of tests that will exercise 100% of the active business rules from the existing program(s), excluding only those business rules which have been explained as unexecutable or otherwise unnecessary. The details of the logic revealed during analysis of the Business Rule Coverage Analysis Report can be documented as algorithmic business rules or abstracted into abstract business rules.
When extracting only algorithmic rules, it is not necessary to abstract these rules—only to reproduce them in a different implementation. Having done so, then the tests that are a by-product of dynamic business rule extraction can be employed to validate the extraction. If the extracted rules produce the same results in the new implementation, then they have been validated.
To perform the validation of the algorithmic business rules, the tests will have to be adapted to the replacement implementation and the baseline database converted to the new database format. Then the test database after all test cases have been executed also has to be converted to a separate instance of the new database format. When executing the converted tests against the converted data, the expected results have to be obtained for each execution. A failure to obtain the expected results constitutes an error in the documentation of the business rules, in the interpretation of the business rules, or in the implementation of the replacement application. After all tests have been executed then the contents of the new database should be equivalent to the final contents from the tests executed against the existing programs. If all expected results are obtained and the final contents test equivalently, then 100% of the algorithmic business rules have been reproduced and thereby validated.
For abstract business rules, validation of 100% coverage is more complex but still readily done and cost effective. For the circumstances in which 100% abstract business rule extraction is pursued, the goal of doing is generally either because the rules are going to be configured into a package or because the application is being redesigned. In order to validate the 100% coverage, a minimal reference implementation is required. Then the actual validation process proceeds against the reference implementation just as for the algorithmic rule validation above.
5.5 Unique Aspects of the Invention











Invention
Prior Art







The coverage analysis module of
Coverage analysis tools


the invention supports or can be
typically support only one


readily extended to support all
or a small number of


grammar based computer
languages because of their 


programming languages executing on
expensive and inflexible


all computer hardware platforms
implementations.


rapidly and at low cost.



The coverage analysis module of
Coverage analysis tools


the invention provides coverage for
support only the


the false branch of a conditional
explicit branches.


statement when there is no explicit



ELSE condition.



The coverage analysis module of
Coverage analysis tools


the invention supports covering all
support only the conditional


conditional clauses of a compound
statement as a whole.


conditional statement.



The invention is fully scaleable to
Both manual methods and


programs of any size and complexity.
static BRE cannot scale to handle



programs of significant size



and complexity without



errors and/or omissions.


The invention can detect whether
Static business rule extraction


all logic paths through any given
tools cannot do this.


program have been executed and can
Furthermore, there is no


maintain the annotations of logic
method by which an analyst


paths that have been explained rather
can determine that they 


than executed.
have reached 100%.


The invention can validate the
Not known to be part of the


extracted algorithmic or abstract
prior art.


business rules by adapting the set of



test cases used for dynamic BRE to



the formats of a replacement program,



and executing them against that



replacement program.



The invention can detect new
Not achievable by any static


business rules added to a replacement
source code analytic process..


program, whether intentionally,



erroneously or maliciously. When



validating 100% business rule



extraction in a replacement program,



if there is any business logic not



executed by the series of tests then



that logic has been added.



The Business Rule Coverage
No other method extracts


Analysis Report allows the creation
abstract business rules.


and maintenance of a list of the



hypothesized abstract business rules as



they are created and refined during the



test and analysis process.



Furthermore, the Business Rule
No other method extracts


Coverage Analysis Report allows each
abstract business rules.


decision point within the program to



be annotated according to which



abstract business rule this logic path is



related, for traceability, the related



abstract business rule having been



created and/or maintained within the



Business Rule Coverage Analysis



Report created and/or updated in step



19.



Furthermore, the Business Rule
No other method extracts


Coverage Analysis Report allows each
abstract business rules.


branch of each decision point within



the program to be displayed color



coded according to whether or not a



business rule has been associated with



this logic path is related.



Furthermore, the Business Rule
No other method has a 


Coverage Analysis Report may be
Business Rule


optionally supplemented with a
Execution Path Report.


Business Rule Execution Path Report



to reveal the sequence of program



statements executed where this is



ambiguous in the Business Rule



Coverage Analysis Report.



Furthermore, the Business Rule
No other method has a


Execution Path Report may optionally
Business Rule


be extended to show the values of
Execution Path Report.


referenced data elements at each



conditional statement executed.









5.6 Business Rule Coverage Analysis Report
The Business Rule Coverage Analysis Report contains both analytical elements and interactive elements. The analytical elements are drawn from the information in the output file from steps (18) and (19) and may be queried but not modified by the business rule analyst.

    a) These analytical elements are created with every execution of an atomic test case, and no interactive elements are entered or persisted to permanent storage. The atomic test case coverage reports must be managed appropriately to ensure that they are not overwritten or otherwise lost during the testing and analysis cycle.
    b) These analytical elements are created when the first cumulative Business Rule Coverage Analysis Report is created for the program with the first cumulative test execution, and updated with every execution of the cumulative test cases thereafter. The interactive elements are persisted to permanent storage and preserved across each update report from cumulative test cases.


The analytical elements of the Business Rule Coverage Analysis Report displays the original program source code, optionally modified as described above to show any implicit false branches and the optional expansion of any compound conditionals, showing all logic paths executed and not executed.
Furthermore, the Business Rule Coverage Analysis Report may or may not be configured to cause the display of each decision point within the program to be color coded according to whether the true branch, false branch or both is unexecuted or unexplained.
Furthermore, the Business Rule Coverage Analysis Report may or may not be configured to cause the display of the program logic within each branch from each decision point within the program to be color coded according to whether that code has been executed.
The interactive elements of the Business Rule Coverage Analysis Report allows each branch of each decision point within the program to be marked by the human analyst according to whether it is obsolete or for some other reason is explained (see section 5.7).
The interactive elements of the Business Rule Coverage Analysis Report allows the entry or updating of information from the analysis by the business rule analyst, which is usually applicable only to the cumulative coverage report. In this small example from a COBOL program (see FIG. 4), we see that the conditional statement at line 00686 has only had the true logic path executed as indicated by the “B1” code in the coverage column, and line 00689 has had neither the true nor the false logic path executed as indicated by the “B0” code. The yellow color coding in the Source column indicates that lines 00686 and 00689 had incomplete or no execution. The red color coding in the Reason True and Reason False columns indicates that a reason is missing if this logic path is to be explained rather than executed:

    a) a reason for the false logic path being unexecuted at line 00686.
    b) a reason for both the true logic path and false logic path being unexecuted at line 00689.


The next step for the dynamic BRE analyst is to create an atomic test case that will cause the unexecuted logic paths to execute, and the test case executed to create a Business Rule Coverage Analysis Report. The existing cumulative set of test cases should be executed and the new atomic test case added to the cumulative set. The results of the cumulative test case execution, after updating the coverage report (see FIG. 5), shows that:

    a) Both logic paths at line 00686 have now been executed, as indicated by the “B3” Coverage code, therefore the red text on yellow color coding in the Source column remains and the red color coding in the Reason False column have both disappeared.
    b) Although the true logic path at line 00689 has had its true branch executed, and therefore the red in the Reason True column has disappeared, the false logic path remains unexecuted. Therefore the red text on yellow color coding in the Source column and the red color coding in the Reason False column remain.
    c) Note that an abstract rule number (“123”) has been entered for the conditional and associated logic path at line 00686 for traceability.


In this case, it is not useful to force the execution of the false logic path at line 00689 because that path contains only technical logic, i.e., there were no business rules found in the analysis of that logic path. Therefore, instead of making a new test case, the dynamic BRE analyst updates the information in the interactive Business Rule Coverage Analysis Report to indicate a reason why that logic path does not need to be executed (see FIG. 6).

    a) In this example, the reason entered was “Abend I/O Error” for the false branch, which resets the red color coding to light grey.
    b) In addition, the dynamic BRE analyst also enters a “filter” code, “F2” in this case, to indicate that the logic path has been explained, which resets the red text on yellow in the Source column to dark blue text on light grey.


The following attributes of the Business Rule Coverage Analysis Report are only relevant to abstract business rule extraction:

    a) The Business Rule Coverage Analysis Report allows the creation and maintenance of a list of the hypothesized abstract business rules as they are created and refined during the test and analysis process.
    b) The Business Rule Coverage Analysis Report allows each decision point within the program to be marked according to which abstract business rule(s) this logic path is related, for traceability, the related abstract business rule having been created and/or maintained within the list created and/or maintained in step 22 of section 5.3.
    c) Furthermore, the Business Rule Coverage Analysis Report optionally allows each branch of each decision point within the program to be displayed color coded according to whether or not a business rule has been associated with this logic path is related.


5.7 Explained Unexecuted Branches
A key aspect of the dynamic business rule extraction is that all logic paths in the program be executed or explained. There are many valid reasons why a logic path need not be analyzed for business rules. The following list is illustrative of explanations but not exhaustive:











Reason
Explanation







Code is
there are no combinations of data conditions that will


unreachable
allow this code to execute.


Code is
there are combinations of data that could cause this


obsolete
logic path to execute, but they are associated with



program functions that are no longer in use.


Code is
this logic serves a technical role within the program but


technical logic
does not contribute to any business meaningful logic.


Program
the analysis uncovered functions that should not be


defects
analyzed because they represent defective logic.


Test logic
specific logic paths are only relevant to program testing



and do not contribute to business knowledge.


Event
adverse operational events are typically associated with


dependent
I/O errors and the logic paths that attempt a recovery, or


logic
they document the error prior to abnormally terminating



the program, or follow a different recovery process.


Data
database referential integrity is enforced in program


consistency
logic. This is captured as a conceptual business rule


failure
but the logic path need not be traversed to do so.

## Claims

1. A computer-implemented method for extracting business rules from an existing program using coverage analysis reporting which statements of the program logic have and have not been executed, wherein the business rules are associated with one or more constraints on the creation, updating and deletion of persistent data, comprising:
generating a coverage analysis report of the execution of the existing program;
identifying and selecting a portion of the program's source code containing one or more business rules from the program's source code statements shown as having been executed in the coverage analysis report;
analyzing the selected portion of the program's source code to identify one or more business rules;
grouping the program's source code statements that are relevant to each business rule identified from the selected portion of the program's source code;
documenting each identified business rule with the algorithmic sequence of program logic steps from the grouped program source code statements that are relevant to that identified business rule;
creating an additional coverage analysis report for the existing program using a different set of data conditions for the purpose of at least one of: identification of additional algorithmic steps relevant to each identified business rule and identification of additional business rules; and
continuing to iterate this process until all active business rules have been identified and until all algorithmic steps identified with each of these identified business rules have been documented.

2. The method of claim 1, further comprising generating an interactive coverage analysis report.

3. The method of claim 2, wherein the interactive coverage analysis report further comprises recordation of one or more annotations for one or more logic paths of the existing program.

4. The method of claim 3, further comprising aggregating and analyzing the one or more annotations and coverage analysis report statistics across a plurality of coverage analysis reports.

5. The method of claim 1, further comprising reporting of false branch logic paths under all forms of expression of conditional statements in the coverage analysis report.

6. The method of claim 1, further comprising reporting of all conditional components of all compound conditional statements in the coverage analysis report.

7. The method of claim 1, further comprising abstracting an algorithmic sequence of program logic steps identified with an identified business rule into an abstract business rule.

8. The method of claim 1, further comprising generating an execution path report comprising an execution path of the existing program.

9. The method of claim 1, further comprising the use of an interactive debugger for the language of the existing program to follow an execution path of the execution of the existing program interactively.

10. The method of claim 1, further comprising a static business rule extraction process to be used in conjunction with the dynamic business rule extraction process to extract each business rule of the existing program.

11. The method of claim 1, further comprising validating the extracted business rules.

12. The method of claim 11, further comprising the detection of erroneously or maliciously added business rules during the validation of the extracted business rules.

13. A computer-implemented system for extracting business rules from an existing program using coverage analysis reporting which statements of the program logic have and have not been executed, wherein the business rules are associated with one or more constraints on the creation, updating and deletion of persistent data, comprising:
generating a coverage analysis report of the execution of the existing program;
identifying and selecting a portion of the program's source code containing one or more business rules from the program's source code statements shown as having been executed in the coverage analysis report;
analyzing the selected portion of the program's source code to identify one or more business rules;
grouping the program's source code statements that are relevant to each business rule identified from the selected portion of the program's source code;
documenting each identified business rule with the algorithmic sequence of program logic steps from the grouped program source code statements that are relevant to that identified business rule;
creating an additional coverage analysis report for the existing program using a different set of data conditions for the purpose of at least one of: identification of additional algorithmic steps relevant to each identified business rule and identification of additional business rules; and
continuing to iterate this process until all active business rules have been identified and until all algorithmic steps identified with each of these identified business rules have been documented.

14. The system of claim 13, providing the means to create an interactive coverage analysis report.

15. The system of claim 13, providing the means to record annotations for selected logic paths.

16. The system of claim 13, providing the means to generate an execution path report.

17. The system of claim 13, providing the means to validate extracted business rules.

18. The system of claim 17, providing the means to detect erroneously or maliciously added business rules during the validation of the extracted business rules.