Patent Document ID: 20160283201
Application ID: 14442653
Patent Status: 0

Claim One:
1. A system behavior simulation method based on an activity diagram model, comprising the following steps: 1) reading a UML activity diagram model stored in XMI format from a disk file; 2) parsing out various model elements, including initial node, final node, decision node, merge node, fork node, join node, action node, activity node, transition edge, and decision condition, from the UML activity diagram model, respectively, wherein, a transition edge is a directed edge for connecting the nodes and indicating a node hopping direction; the decision condition is a condition attached to a transition edge to control a token transition; the token is flag data that indicates an accessed node; 3) traversing the UML activity diagram model in a hybrid execution approach that incorporates symbolic execution and actual execution, and generating simulation test cases, wherein, the symbolic execution is to express variables as symbols for operating, a set of symbolic expressions of the input variables as the operation result, and accordingly update a symbol value table of the variables; whereas the actual execution is to substitute the variables with specific values and execute operations to obtain a set of specific values as the operation result, and accordingly update a specific value table of the variables; 31) initializing a constraint condition stack, a token, variable tables, a node coverage threshold, and a constraint solver, according to various model elements parsed from the UML activity diagram model, wherein, the constraint condition stack is a stack data structure configured to store constraint conditions; the token transition indicates a value change of token flag data, the variable tables include value table and symbol table of variables; the node coverage is the ratio of the number of accessed nodes to the total number of nodes parsed from the UML activity diagram model, and the node coverage value is calculated and updated continuously according to the node access condition, while the node coverage threshold is preset; the constraint solver is configured to solve a set of constraint conditions to obtain specific variable values that meet the set of constraint conditions; 32) generating a set of input variable values randomly to enable the token to be transited in the direction of the transition edge, and treating different types of accessed nodes in different ways, respectively; 321) if the accessed node is an initial node, making no treatment and skipping the token in the direction of exit edge to the next activity node; 322) if the accessed node is an action node, adopting symbolic execution and actual execution respectively for the statements in the node according to the semantics represented by the node, and updating the input variable values and node coverage value; 323) if the accessed node is an activity node, entering into the UML activity diagram model associated to the node, and entering into step 1) to execute another UML activity diagram model simulation process; 324) if the accessed node is a decision node, selecting a token transition edge according to the decision condition on the exit edge of the node, and pushing the decision condition corresponding to the token transition edge into the constraint condition stack for subsequent use; 325) if the accessed node is a merge node, directly transiting the token into the next activity; 326) if the accessed node is a fork node, replicating the token into a specific number of copies determined according to the number of exit edges of the fork node, and transiting backwards the tokens obtained by replication along the transition edge respectively; 327) if the accessed node is a join node, observing the condition of tokens transited to the nodes concurrent with the accessed node, and merging these tokens into one token and moving backwards in the direction of the transition edge if the tokens on all of the concurrent nodes are to be transited to the accessed node; 328) if the accessed node is a final node, reading all constraint conditions in the constraint condition stack, taking out the stack top constraint and negating it, and then inputting the negated stack top constraint together with other constraints in the stack into the constraint solver to solve the constraints; updating the input variable values and storing the set of input variable values as a set of simulation test cases if the constraint solution is successful; otherwise saving path conditions that can not be solved and corresponding traversing paths and having them confirmed manually by an operator, and at the same time, popping off the stack top element in the constraint condition stack, taking out the next constraint condition in the stack and negating it, and then inputting the negated constraint together with other constraints in the stack into the constraint solver to solve the constraints, and updating the input variable values; 329) calculating and updating the node coverage value according to the node access condition; returning the token to the initial node, transiting the token in the direction of the transition edge with the input variable values updated in step 328), and entering into step 321), if the node coverage value goes beyond the node coverage threshold; otherwise entering into step 4); 4) inputting the simulation test cases stored in the above steps, to carry out simulated execution of the UML activity diagram model.