WO2014180106A1 - 一种基于活动图模型的系统行为仿真方法 - Google Patents

一种基于活动图模型的系统行为仿真方法 Download PDF

Info

Publication number
WO2014180106A1
WO2014180106A1 PCT/CN2013/086991 CN2013086991W WO2014180106A1 WO 2014180106 A1 WO2014180106 A1 WO 2014180106A1 CN 2013086991 W CN2013086991 W CN 2013086991W WO 2014180106 A1 WO2014180106 A1 WO 2014180106A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
constraint
execution
model
token
Prior art date
Application number
PCT/CN2013/086991
Other languages
English (en)
French (fr)
Inventor
王林章
俞磊
卜磊
李宣东
陈志�
Original Assignee
南京大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 南京大学 filed Critical 南京大学
Priority to US14/442,653 priority Critical patent/US9594543B2/en
Publication of WO2014180106A1 publication Critical patent/WO2014180106A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation

Definitions

  • the invention relates to a system behavior simulation method based on a unified modeling language activity diagram model, which mainly utilizes a combination of symbol execution and specific execution to solve the generation problem of the simulation use case, thereby realizing the simulation of the system behavior. It belongs to the field of software engineering, model-driven engineering, and system simulation crossover technology. Background technique
  • Model-based software testing belongs to the scope of protocol-based software testing. It is characterized by: When generating test cases and evaluating test results, they are based on the model of the application under test and its derived model (generally called test model). .
  • a software model is an abstract description of software behavior and software structure. Software behavior can be described in terms of system input sequences, activities, conditions, output logic, or data streams.
  • Model-based testing is a type of automated testing that is based on a model that automatically generates a large number of test cases for a system under test as a whole.
  • a model is an abstraction that describes the behavior of an aspect of a system under test.
  • Model-based testing First, the system is modeled according to system requirements and functional specifications, and then test cases are automatically generated based on the model, and finally the verification process is performed. Model-based testing yields the following benefits: Reduce schedules, reduce costs, improve quality, get user behavior models, improve communication between development and testing, uncover ambiguity in specification and design, and automate test generation, autorun Test to reduce changes to test suites caused by changes in requirements.
  • Hybrid execution techniques are techniques that combine symbolic execution with specific implementation. Symbolic execution refers to the technique of using a symbol variable instead of a specific variable to perform correlation analysis without executing a program, and is generally used in conjunction with a method for solving a problem. Specific execution refers to the use of specific variable values to enter into the program, the normal execution of the driver. Hybrid execution technology is a hybrid software program verification technique that performs program execution and symbol execution alternately. Summary of the invention
  • Unified Modeling Language has become the de facto standard for modeling languages, existing from the Unified Modeling Language
  • the animation generation test case method cannot automatically generate test cases, and requires manual participation to a certain extent. Therefore, the simulation of the unified modeling language activity map can only be performed semi-automatically.
  • the object of the present invention is to provide a system behavior simulation method based on an activity graph model, which solves the problems of simulation use case generation for simulation execution, execution environment construction of model simulation, coverage statistics during model simulation execution, and feedback of execution results.
  • the present invention first reads and parses the unified modeling language activity graph model to be simulated, extracts important model element information and constructs a complete model map in memory; and then reads the unified modeling language activity
  • the graph model is parsed, and various model elements are parsed from the unified modeling language activity graph model.
  • the steps included in the system behavior simulation method based on the activity graph model are:
  • the symbol execution is to represent the variable as a symbol to perform an operation, and the operation result is one of the input variables a group symbol expression, thereby updating the symbol value table of the variable;
  • the specific execution is performed by a specific numerical value, and the result is also a specific numerical value, and the specific value table of the variable is updated thereby;
  • the constraint condition stack is a stack storing constraints Data structure
  • the movement of the token indicates that the token tag data value changes, that is, the accessed node changes
  • the variable table includes a variable specific value table and a variable symbol value table
  • the node coverage is visited.
  • the number of nodes accounts for the proportion of all parsed nodes in the unified modeling language activity graph model.
  • the node coverage value is continuously updated according to the access status of the node, and the node coverage threshold is preset; the constraint solver is used for one
  • the group constraint condition is solved to obtain a specific value of the variable that satisfies the constraint condition of the group; 32) randomly generate a set of input variable specific values, so that the token moves along the direction of the transfer edge, and adopt different processing measures for the different types of nodes accessed;
  • the visited node is a decision node, according to the determination condition on the outbound edge of the node, the edge on which the token is transferred is selected, and the corresponding determination condition on the edge is pressed into the constraint condition stack for later use;
  • the visited node is a fork node
  • the token copies itself and the number of copies is determined according to the number of outgoing edges of the fork node, and the copied tokens are respectively moved backward along the transition edge;
  • the accessed node is a terminating node
  • all the constraints in the constraint stack are read, the top-of-stack constraint is taken out and inverted, and then the inverted top-of-stack constraint is input to the constraint solving with other constraints in the stack.
  • the constraint solution is performed in the device. If the constraint solution is successful, the specific value of the input variable is updated, and the specific value of the input variable is stored as a set of simulation use cases; if the constraint solution fails, the path condition that cannot be solved and the corresponding traversal path are saved.
  • the operator manually confirms the cause, and pops the top element of the constraint stack on the stack, takes the next stack constraint and inverts it, and then inputs the inverted constraint with other constraints in the stack to the constraint solver. Perform constraint solving to update the specific value of the input variable;
  • the system behavior simulation method based on the unified modeling language activity graph model of the present invention is implemented Automatic simulation use case generation for unified modeling language activity diagram model simulation execution, simulation execution environment construction of unified modeling language activity diagram model, node coverage information statistics of unified modeling language activity diagram model simulation use case, and simulation execution result feedback .
  • the method of the present invention has the following beneficial effects:
  • test case automatic generation for the activity graph model simulation execution is realized by combining the mixed execution ideas.
  • the generated test case includes a specific input value, a model execution sequence corresponding to the input value, and a desired output.
  • the system behavior simulation method based on the unified modeling language activity diagram model of the present invention constructs a simulation execution environment of the unified modeling language activity diagram model, so that the activity diagram model can accept automatically generated test cases and automatically Simulation execution. While the model simulation is being executed, the coverage of the generated simulation cases on the model can also be collected, and the execution results can be fed back in real time.
  • Figure 1 is a flow chart of a system behavior simulation method based on the Unified Modeling Language Activity Graph Model. detailed description
  • the unified modeling language activity graph model is saved in the same way as most unified modeling language models. It is based on the extended markup language metadata exchange format.
  • the extensible markup language parsing tool dom4j can be used. Because dom4j supports the visitor design pattern, you can customize a class that implements the visitor interface and override all operations that handle different node types and node properties. The following describes the operation of each node type and attribute:
  • Start node Read the start node identifier and instantiate the start node.
  • Action node Record the node ID, connect the incoming and outgoing edges connected to it, save the value of the active behavior attribute on the node, and instantiate the node.
  • Active node Record the node ID, connect the incoming and outgoing edges connected to it, save the value of the associated activity graph attribute on the node, and instantiate the node.
  • Decision node Record the node identifier, connect the incoming and outgoing edges connected to it, and instantiate the node.
  • Merge node Record the node ID, connect the incoming and outgoing edges connected to it, and instantiate the node.
  • Fork node Record the node ID, connect the incoming and outgoing edges connected to it, and instantiate the node.
  • Join node Record the node ID, connect the incoming and outgoing edges connected to it, and instantiate the node.
  • Terminate the node Record the node ID, connect the incoming edges connected to it, and instantiate the node.
  • Hybrid execution is a combination of specific execution and symbolic execution.
  • the process of traversing the activity graph performs the two execution operations separately on the different semantics reflected on the node.
  • Action node The processing of the action node is performed in two parts:
  • a) Perform specific execution of the statement in the node according to the specific value variable table, and update the specific value variable table according to the result of the execution.
  • Non-input variables may appear during this process, and any new variables are added to the specific value variable table.
  • the purpose of the specific implementation is to update the specific values of the variables in real time by understanding the execution semantics of the model, and then determine the control flow direction of the model.
  • the activity node is associated with another activity diagram model, so once the token transitions to this type of node, it actually enters another activity diagram, and all subsequent operations are naturally similar to recursion.
  • the constraint selected on the node is pushed into the constraint stack. Do it later.
  • Merge node The merge node is the logical successor of the decision node. When the node is encountered, the token goes directly to the next activity.
  • Fork node The fork node is used to indicate the origin of the issuance. When a node of this type is encountered, the token copies itself, and the number of copies is determined according to the number of outgoing edges of the fork node. The resulting copy of the token continues to move backwards along the transition edge.
  • join node is the logical successor of the fork node. When a token encounters the node, it waits in place until all the tokens on the edge are transferred to the node and merged into one order. Card, move backwards according to the direction of the transfer edge.
  • Terminating the node When the terminal is terminated, the program can get a complete execution path. At this time, all the constraints in the path condition stack are read, the constraints at the top of the stack are taken out and inverted, and then the inverted top of the stack is taken. Constraints are input to the constraint solver by other constraints in the stack, so that a new set of input variable specific values can be obtained to drive the new traversal process.
  • the depth-first traversal strategy is to reverse the condition constraint, and then select the condition of the top of the path condition stack to perform the negation. If a failure occurs during the constraint solving process, the associated path constraint and traversal path are separately saved and fed back to the user. Then, the top of the constraint stack is constrained out of the stack, the next constraint is taken out, and the constraint is solved by combining other constraints in the constraint stack to generate a new input variable specific value.
  • the updated node coverage value is calculated according to the accessed status of the node.
  • the token returns to the initial node, and the updated input variable specific value is used to drive the token. Moving along the direction of the transition edge, repeating the automatic generation of the simulation use case; when the node coverage value exceeds the node coverage threshold, the simulation generation automatic generation process ends, and the next step is entered.
  • a set of input variable specific values are collected, and the specific values of these input variables are used as simulation cases for simulating the unified modeling language activity diagram model.
  • the simulation use case is stored in the external file in the form of a key-value pair, which can be used for review by the operator. Secondly, it can be used for regression testing after the model iterative update.
  • the program reads the simulation test case from the external file.
  • a set of use cases can drive a simulation execution of the unified modeling language activity diagram model. At the same time of execution, it can observe which nodes have passed through the activity diagram, and what operations have been performed. What behaviors are called, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • Debugging And Monitoring (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

本发明是一种基于活动图模型的系统行为仿真方法,首先读取并解析待仿真的统一建模语言活动图模型,从中抽取出重要的模型元素信息并在内存中构建一个完整的模型映射;然后对读入的统一建模语言活动图模型进行解析,分别从统一建模语言活动图模型中解析出各种模型元素;再结合采用混合执行的思想对其进行持续的具体执行、符号执行以及约束求解,在达到节点覆盖度阈值的情况下结束该过程;最后使用上一步收集到的仿真用例对统一建模语言活动图模型进行仿真执行。实现了用于统一建模语言活动图模型仿真执行的仿真用例自动生成、统一建模语言活动图模型的仿真执行环境构建、统一建模语言活动图模型仿真用例的节点覆盖度信息统计以及仿真执行结果反馈。

Description

一种基于活动图模型的系统行为仿真方法
技术领域
本发明涉及一种基于统一建模语言活动图模型的系统行为仿真方法,主要利用符号执 行和具体执行相结合的技术来解决仿真用例的生成问题, 进而实现对系统行为的仿真。 属于软件工程、 模型驱动工程、 系统仿真交叉技术领域。 背景技术
对模型反映的软件行为进行仿真是软件测试领域的一种重要方法。 软件测试和验证 是保证软件正确性和提高软件可靠性的最基本和最重要的手段, 也是工业界使用的主流 技术。 随着面向对象软件开发技术的广泛应用和软件测试自动化的要求, 基于模型的软 件测试逐渐得到重视。 基于模型的软件测试属于基于规约的软件测试范畴, 其特点是: 在产生测试用例和进行测试结果评价时, 都是根据被测试应用程序的模型及其派生模型 (一般称为测试模型) 进行的。 软件模型是对软件行为和软件结构的抽象描述。 软件行 为可以用系统输入序列、 活动、 条件、 输出逻辑或者数据流进行描述。
基于模型的测试是自动化测试的一种, 这种测试基于模型, 一次性地将一个被测系 统的大量测试用例作为整体自动生成出来。 模型是一种抽象, 描述被测试系统的某方面 的行为。 基于模型的测试方式: 首先根据系统需求、 功能规格说明对系统进行建模, 然 后根据模型自动生成测试用例, 最后执行验证过程。 基于模型的测试能产生下列好处: 縮短日程, 降低成本, 提高质量, 得到用户行为模型, 提高开发和测试的沟通, 尽早发 掘出规格说明和设计中的含混性因素, 以及自动生成测试, 自动运行测试, 减少需求变 更带来的测试套件的变更。
混合执行技术是符号执行和具体执行结合的技术。 符号执行指的是使用符号变量代 替具体变量, 不执行程序的前提下模拟程序执行来进行相关分析的技术, 一般与约束满 足问题求解方法一同使用。 具体执行就是指使用具体的变量值输入到程序中, 驱动程序 的正常执行。 而混合执行技术是一种对程序交替进行具体执行和符号执行的混合软件程 序验证技术。 发明内容
技术问题: 统一建模语言已经成为建模语言的事实标准, 现有的从统一建模语言活 动图生成测试用例方法不能全自动地生成测试用例, 在一定程度上需要人工的参与, 因 此对统一建模语言活动图的仿真亦只能半自动的进行。 本发明的目的是提供一种基于活 动图模型的系统行为仿真方法, 解决用于模拟执行的仿真用例生成、 模型仿真的执行环 境构建、 模型仿真执行时的覆盖度统计、 执行结果反馈等问题。
技术方案: 本发明首先读取并解析待仿真的统一建模语言活动图模型, 从中抽取出 重要的模型元素信息并在内存中构建一个完整的模型映射; 然后对读入的统一建模语言 活动图模型进行解析, 分别从统一建模语言活动图模型中解析出各种模型元素; 再结合 采用混合执行的思想对其进行持续的具体执行、 符号执行以及约束求解, 在达到节点覆 盖度阈值的情况下结束该过程; 最后使用上一步收集到的仿真用例对统一建模语言活动 图模型进行仿真执行。
基于活动图模型的系统行为仿真方法所包含的步骤为:
1 )从磁盘文件读入以基于扩展标记语言的元数据交换格式保存的统一建模语言活动 图模型;
2)从已读入的统一建模语言活动图模型中分别解析出各种模型元素,包括初始节点、 终止节点、 决策节点、 合并节点、 分叉节点, 联接节点、 动作节点、 活动节点、 转移边 和判定条件; 所述转移边是用于连接各个节点的有向边, 表明节点跳转的方向; 所述判 定条件是附着在转移边上控制令牌发生变化的条件; 所述令牌是指示所访问节点的标记 数据;
3)使用符号执行和具体执行相结合的混合执行方法对统一建模语言活动图模型进行 遍历, 生成仿真用例; 所述符号执行是将变量表示为符号来进行运算, 运算结果是输入 变量的一组符号表达式, 以此更新变量的符号值表; 所述具体执行是以具体数值代入运 算, 结果也是具体的数值, 并以此更新变量的具体值表;
31) 根据统一建模语言活动图模型解析出的各个模型元素, 对约束条件栈、 令牌、 变量表、 节点覆盖度阈值以及约束求解器进行初始化; 所述约束条件栈是存储约束条件 的栈数据结构; 所述令牌的移动表示令牌标记数据取值发生变化, 即所访问的节点发生 变化; 所述变量表包括变量具体值表和变量符号值表; 所述节点覆盖度是访问过的节点 数占统一建模语言活动图模型中所有解析出的节点数目的比例, 节点覆盖度值根据节点 已访问情况不断计算更新, 节点覆盖度阈值要预先设置; 所述约束求解器用于对一组约 束条件进行求解, 得到满足该组约束条件的变量具体值; 32) 随机地生成一组输入变量具体值, 使令牌沿着转移边的方向进行移动, 对访问 到的不同类型节点分别采取不同的处理措施;
321)当访问到的节点是动作节点, 则不做任何处理, 令牌按出边的方向跳转至下一 个活动节点;
322)当访问到的节点是动作节点, 则根据该节点所表示的语义, 对其中的语句分别 采取符号执行和具体执行, 并更新输入变量具体值、 节点覆盖度值;
323)当访问到的节点是活动节点, 则进入该节点所关联的统一建模语言活动图模型, 进入步骤 1 ), 进行另外的统一建模语言活动图模型仿真处理;
324)当访问到的节点是决策节点, 则根据该节点出边上的判定条件, 选择令牌发生 转移的边, 将该边上对应的判定条件压入约束条件栈留做后用;
325)当访问到的节点是合并节点, 则令牌直接转入下一个活动;
326)当访问到的节点是分叉节点, 则令牌复制自身, 复制的个数根据分叉节点的出 边的个数来确定, 复制得到的令牌沿着转移边分别向后转移;
327)当访问到的节点是联接节点, 则观察转移到该节点的并发节点上的令牌情况, 当所有并发节点上的令牌转移到该节点上, 则将这些令牌合并成一个令牌按照转移边的 指向向后移动;
328)当访问到的节点是终止节点, 则读取约束条件栈中的所有约束条件, 取出栈顶 约束并取反, 然后将取反后的栈顶约束同栈内其他的约束输入到约束求解器中进行约束 求解, 若约束求解成功, 更新输入变量具体值, 该组输入变量具体值存储起来作为一组 仿真用例; 若约束求解失败, 则将无法求解的路径条件及对应的遍历路径保存出来, 交 由操作人员人工确认原因, 同时将约束条件栈的栈顶元素出栈, 取出下一个栈内约束条 件并取反, 再将取反后的约束同栈内其他的约束输入到约束求解器中进行约束求解, 更 新输入变量具体值;
329) 根据节点已访问情况, 计算更新节点覆盖度值, 当节点覆盖度值没有超过节点 覆盖度阈值, 则令牌重新回到初始节点, 使用步骤 328)更新后的输入变量具体值使令牌 沿着转移边的方向进行移动, 进入步骤 321 ); 当节点覆盖度值超过节点覆盖度阈值, 则 进入步骤 4);
4) 输入以上步骤存储起来的仿真用例, 对统一建模语言活动图模型进行仿真执行。 有益效果: 本发明所述的基于统一建模语言活动图模型的系统行为仿真方法实现了 用于统一建模语言活动图模型仿真执行的仿真用例自动生成、 统一建模语言活动图模型 的仿真执行环境构建、 统一建模语言活动图模型仿真用例的节点覆盖度信息统计以及仿 真执行结果反馈。 具体来说, 本发明所述的方法具有如下的有益效果:
4、 在本发明所述的基于统一建模语言活动图模型的系统行为仿真方法中,通过结合 混合执行的思想, 实现了用于活动图模型仿真执行的测试用例自动生成。 生成的测试用 例包括具体的输入值、 该输入值对应的模型执行序列以及期望的输出。 这些用例可以为 软件开发生命周期中系统实现后的单元测试以及集成测试服务,实现了测试用例的复用, 提高了测试效率, 降低了测试成本。
5、 本发明所述的基于统一建模语言活动图模型的系统行为仿真方法中,构建了统一 建模语言活动图模型的仿真执行环境, 使得活动图模型能够接受自动生成的测试用例并 自动化地仿真执行。 模型仿真执行的同时, 还可以收集生成的仿真用例在模型上的覆盖 度, 并实时地反馈执行结果。 附图说明
图 1是基于统一建模语言活动图模型的系统行为仿真方法流程图。 具体实施方式
下面对本发明的具体实施方式作更详细的描述。
一. 读取与解析统一建模语言活动图模型
统一建模语言活动图模型的保存同大部分统一建模语言模型一样是基于扩展标记语 言的元数据交换格式, 在具体实施中, 可以采用可扩展标记语言解析工具 dom4j。 由于 dom4j 对访问者设计模式的支持, 可通过自定义一个实现访问者接口的类, 对其中的访 问方法重载所有处理不同节点类型和节点属性的操作。 下面就对各节点类型和属性的操 作做具体描述:
(1) 起始节点: 读入起始节点标识, 实例化起始节点。
(2) 动作节点: 记录节点标识, 连接与其相连的各条入边和出边, 保存该节点上的活 动行为属性的值, 实例化该节点。
(3) 活动节点: 记录节点标识, 连接与其相连的各条入边和出边, 保存该节点上关联 活动图属性的值, 实例化该节点。 (4) 决策节点: 记录节点标识, 连接与其相连的各条入边和出边, 实例化该节点。
(5) 合并节点: 记录节点标识, 连接与其相连的各条入边和出边, 实例化该节点。
(6) 分叉节点: 记录节点标识, 连接与其相连的各条入边和出边, 实例化该节点。
(7) 联接节点: 记录节点标识, 连接与其相连的各条入边和出边, 实例化该节点。
(8) 终止节点: 记录节点标识, 连接与其相连的各条入边, 实例化该节点。
通过对以上各种类型节点及其属性的解析, 在程序内存中建立起与统一建模语言活 动图模型对应的数据结构。
二. 采用深度优先策略结合混合执行思想自动化生成仿真用例
混合执行是具体执行、 符号执行两种执行操作相结合的一种方法。 在具体实施中, 遍历活动图的过程要对节点上反映出的不同语义分别进行这两种执行操作。 下面描述对 于不同类型的节点在处理时的具体方式:
(1) 起始节点: 不做任何处理, 令牌按出边的方向跳转至下一个活动节点。
(2) 动作节点: 对动作节点的处理分两部分进行:
a)依照具体值变量表对节点内的语句进行具体执行, 根据执行的结果更新具体值变 量表。 在这个过程中可能出现非输入的变量, 凡是新出现的变量, 也都加进具体值变量 表中。 具体执行的目的在于通过理解模型的执行语义, 实时更新变量具体值, 进而确定 模型的控制流方向。
b)在对节点内语句进行具体执行的同时, 也要对其进行符号执行的操作。 符号执行 的过程, 是不断更新用于表示变量符号表中和输入变量相关的系数数组的过程。 符号执 行的目的在于收集执行路径上的约束条件(我们称之为路径条件), 通过对这些路径条件 的约束求解, 进一步产生能够驱动下一次混合执行过程的具体仿真用例。
(3) 活动节点
活动图模型中, 活动节点会关联另外一个活动图模型, 所以一旦令牌过渡到了这个 类型的节点上, 实际也就是进入了另一个活动图, 随后的所有操作自然和递归类似。
(4) 决策节点: 当遇到决策节点时, 要分以下两步进行处理:
a)根据具体值变量表计算出满足判定条件的分支是哪一条, 令牌按照这一条分支指 向的节点进行转移。
b) 在具体计算的时候, 也要完成变量符号表的更新。
在具体实施中, 以上步骤结束后, 要将该节点上选取的约束条件压入约束条件栈留 做后用。
(5) 合并节点: 合并节点是决策节点的逻辑后继, 当遇到该节点时令牌直接转入下一 个活动。
(6) 分叉节点: 分叉节点用于表示并发行为的起始, 当遇到该类型节点时, 令牌复制 自身, 复制的个数根据分叉节点的流出转移边的个数确定。接下来复制得到的令 牌继续沿着转移边向后转移。
(7) 联接节点: 联接节点是分叉节点的逻辑后继, 当某一令牌遇到该节点时就在原地 等待, 一直到所有如边上的令牌转移到了该节点上再合并成一个令牌, 按照转移 边的指向向后移动。
(8) 终止节点: 遇到终止节点时程序可以得到一条完整的执行路径, 此时读取路径条 件栈中的所有约束条件, 取出栈顶的约束并取反, 然后将取反后的栈顶约束同栈 内其他的约束输入到约束求解器中进行求解,这样就可以得到一组新的输入变量 具体值用以驱动新的遍历过程。
在具体实施中,深度优先的遍历策略是在对条件约束进行取反时,依次选取路径条件 栈栈顶的条件出来进行取反。 如果在约束求解过程中发生失败的情况, 则将与其有关的 路径约束和遍历路径单独保存出来反馈给用户。 接着, 将约束条件栈的栈顶约束出栈, 取出下一个约束条件对其取反, 并结合约束条件栈中的其他约束进行约束求解以生成新 的输入变量具体值。
在具体实施中, 根据节点已访问情况, 计算更新节点覆盖度值, 当节点覆盖度值没有 超过节点覆盖度阈值时, 令牌重新回到初始节点, 使用更新后的输入变量具体值驱动令 牌沿着转移边的方向进行移动, 重复仿真用例自动生成过程; 当节点覆盖度值超过节点 覆盖度阈值, 则结束仿真用例自动生成过程, 进入下一个步骤。
三. 使用生成的仿真用例对统一建模语言活动图进行仿真
在具体实施中,经过以上步骤收集到出一组输入变量具体值,这些输入变量具体值作 为仿真用例用于对统一建模语言活动图模型进行仿真。 仿真用例是以键值对的形式保存 在外部文件中的, 一来可以供操作人员审查, 二来可以用于模型迭代更新后回归测试用。 仿真时, 程序从外部文件读入仿真测试用例, 一组用例可以驱动统一建模语言活动图模 型的一次仿真执行, 在执行的同时可以观察到活动图经过了哪些节点, 进行了哪些操作, 进行了哪些行为调用等。

Claims

权利要求书
1. 一种基于活动图模型的系统行为仿真方法, 其特征在于该方法所包含的步骤 为:
1 ) 从磁盘文件读入以基于扩展标记语言的元数据交换格式保存的统一建模语言活动 图模型;
2) 从已读入的统一建模语言活动图模型中分别解析出各种模型元素, 包括初始节 点、 终止节点、 决策节点、 合并节点、 分叉节点, 联接节点、 动作节点、 活动节点、 转 移边和判定条件; 所述转移边是用于连接各个节点的有向边, 表明节点跳转的方向; 所 述判定条件是附着在转移边上控制令牌发生变化的条件; 所述令牌是指示所访问节点的 标记数据;
3) 使用符号执行和具体执行相结合的混合执行方法对统一建模语言活动图模型进行 遍历, 生成仿真用例; 所述符号执行是将变量表示为符号来进行运算, 运算结果是输入 变量的一组符号表达式, 以此更新变量的符号值表; 所述具体执行是以具体数值代入运 算, 结果也是具体的数值, 并以此更新变量的具体值表;
31) 根据统一建模语言活动图模型解析出的各个模型元素, 对约束条件栈、 令牌、 变 量表、 节点覆盖度阈值以及约束求解器进行初始化; 所述约束条件栈是存储约束条件的 栈数据结构; 所述令牌的移动表示令牌标记数据取值发生变化, 即所访问的节点发生变 化; 所述变量表包括变量具体值表和变量符号值表; 所述节点覆盖度是访问过的节点数 占统一建模语言活动图模型中所有解析出的节点数目的比例, 节点覆盖度值根据节点已 访问情况不断计算更新, 节点覆盖度阈值要预先设置; 所述约束求解器用于对一组约束 条件进行求解, 得到满足该组约束条件的变量具体值;
32) 随机地生成一组输入变量具体值, 使令牌沿着转移边的方向进行移动, 对访问到 的不同类型节点分别采取不同的处理措施;
321)当访问到的节点是动作节点, 则不做任何处理, 令牌按出边的方向跳转至下一个 活动节点;
322)当访问到的节点是动作节点, 则根据该节点所表示的语义, 对其中的语句分别采 取符号执行和具体执行, 并更新输入变量具体值、 节点覆盖度值;
323)当访问到的节点是活动节点, 则进入该节点所关联的统一建模语言活动图模型, 进入步骤 1 ), 进行另外的统一建模语言活动图模型仿真处理;
324)当访问到的节点是决策节点, 则根据该节点出边上的判定条件, 选择令牌发生转 移的边, 将该边上对应的判定条件压入约束条件栈留做后用;
325)当访问到的节点是合并节点, 则令牌直接转入下一个活动;
326)当访问到的节点是分叉节点, 则令牌复制自身, 复制的个数根据分叉节点的出边 的个数来确定, 复制得到的令牌沿着转移边分别向后转移;
327)当访问到的节点是联接节点, 则观察转移到该节点的并发节点上的令牌情况, 当 所有并发节点上的令牌转移到该节点上, 则将这些令牌合并成一个令牌按照转移边的指 向向后移动;
328)当访问到的节点是终止节点, 则读取约束条件栈中的所有约束条件, 取出栈顶约 束并取反, 然后将取反后的栈顶约束同栈内其他的约束输入到约束求解器中进行约束求 解, 若约束求解成功, 更新输入变量具体值, 该组输入变量具体值存储起来作为一组仿 真用例; 若约束求解失败, 则将无法求解的路径条件及对应的遍历路径保存出来, 交由 操作人员人工确认原因, 同时将约束条件栈的栈顶元素出栈, 取出下一个栈内约束条件 并取反, 再将取反后的约束同栈内其他的约束输入到约束求解器中进行约束求解, 更新 输入变量具体值;
329) 根据节点已访问情况, 计算更新节点覆盖度值, 当节点覆盖度值没有超过节点 覆盖度阈值, 则令牌重新回到初始节点, 使用步骤 328)更新后的输入变量具体值使令牌 沿着转移边的方向进行移动, 进入步骤 321 ); 当节点覆盖度值超过节点覆盖度阈值, 则 进入步骤 4);
4) 输入以上步骤存储起来的仿真用例, 对统一建模语言活动图模型进行仿真执行。
PCT/CN2013/086991 2013-05-08 2013-11-13 一种基于活动图模型的系统行为仿真方法 WO2014180106A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US14/442,653 US9594543B2 (en) 2013-05-08 2013-11-13 Activity diagram model-based system behavior simulation method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310168258.8 2013-05-08
CN201310168258.8A CN103246770B (zh) 2013-05-08 2013-05-08 一种基于活动图模型的系统行为仿真方法

Publications (1)

Publication Number Publication Date
WO2014180106A1 true WO2014180106A1 (zh) 2014-11-13

Family

ID=48926288

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/086991 WO2014180106A1 (zh) 2013-05-08 2013-11-13 一种基于活动图模型的系统行为仿真方法

Country Status (3)

Country Link
US (1) US9594543B2 (zh)
CN (1) CN103246770B (zh)
WO (1) WO2014180106A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113836607A (zh) * 2021-09-24 2021-12-24 广东工业大学 一种立体仓库的参数化仿真设计方法及其仿真设计系统

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103246770B (zh) 2013-05-08 2015-10-14 南京大学 一种基于活动图模型的系统行为仿真方法
CN105550443B (zh) * 2015-12-11 2019-05-28 中国航空工业集团公司西安航空计算技术研究所 一种基于SystemC周期精确的统一染色器阵列TLM模型
GB2547221A (en) * 2016-02-10 2017-08-16 Testplant Europe Ltd Method of, and apparatus for, testing computer hardware and software
US10956399B1 (en) * 2016-06-30 2021-03-23 Amazon Technologies, Inc. Transaction pipelining in a journaled database
US20180143951A1 (en) * 2016-11-21 2018-05-24 Kong Ping Oh Automatic creation of hierarchical diagrams
CN108629124B (zh) * 2018-05-09 2022-07-08 华东师范大学 一种基于活动图路径的仿真参数数据自动生成方法
CN109271630B (zh) * 2018-09-11 2022-07-05 成都信息工程大学 一种基于自然语言处理的智能标注方法及装置
CN109165170B (zh) * 2018-10-16 2022-03-11 杭州安恒信息技术股份有限公司 一种自动化请求测试的方法及系统
EP3792787A1 (en) * 2019-09-14 2021-03-17 Tata Consultancy Services Limited Method and system for test case generation for event based systems using graph path traversal
CN110956015B (zh) * 2019-12-04 2023-08-01 北京华大九天科技股份有限公司 一种检查双重图形制造约束的方法
CN113238932B (zh) * 2021-04-30 2024-03-19 西南电子技术研究所(中国电子科技集团公司第十研究所) 测试用例自动生成方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459914A (zh) * 2008-12-31 2009-06-17 中山大学 基于蚁群算法的无线传感器网络节点覆盖优化方法
CN101464797A (zh) * 2008-12-09 2009-06-24 北京星网锐捷网络技术有限公司 基于统一建模语言活动图自动生成测试用例的方法及系统
US8117591B1 (en) * 2005-01-07 2012-02-14 Interactive TKO, Inc. Graphical model for test case viewing, editing, and reporting
CN102799530A (zh) * 2012-07-24 2012-11-28 浙江工商大学 一种基于uml架构的软件系统的性能预测方法
CN103246770A (zh) * 2013-05-08 2013-08-14 南京大学 一种基于活动图模型的系统行为仿真方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7685576B2 (en) * 2004-01-26 2010-03-23 Siemens Corporation System and method for model based system testing of interactive applications
US20060253839A1 (en) * 2005-03-30 2006-11-09 Alberto Avritzer Generating performance tests from UML specifications using markov chains
US7581138B2 (en) * 2005-10-24 2009-08-25 International Business Machines Corporation Method, system and computer program for managing test processes based on customized UML diagrams
US20070288885A1 (en) * 2006-05-17 2007-12-13 The Mathworks, Inc. Action languages for unified modeling language model
US8443336B2 (en) * 2007-10-03 2013-05-14 Siemens Corporation System and method for applying model-based testing to train control systems
KR101408870B1 (ko) * 2012-11-06 2014-06-17 대구교육대학교산학협력단 Uml sd로부터 mccfg를 기반으로 하는 다단계 테스트 케이스 생성장치 및 방법

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8117591B1 (en) * 2005-01-07 2012-02-14 Interactive TKO, Inc. Graphical model for test case viewing, editing, and reporting
CN101464797A (zh) * 2008-12-09 2009-06-24 北京星网锐捷网络技术有限公司 基于统一建模语言活动图自动生成测试用例的方法及系统
CN101459914A (zh) * 2008-12-31 2009-06-17 中山大学 基于蚁群算法的无线传感器网络节点覆盖优化方法
CN102799530A (zh) * 2012-07-24 2012-11-28 浙江工商大学 一种基于uml架构的软件系统的性能预测方法
CN103246770A (zh) * 2013-05-08 2013-08-14 南京大学 一种基于活动图模型的系统行为仿真方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113836607A (zh) * 2021-09-24 2021-12-24 广东工业大学 一种立体仓库的参数化仿真设计方法及其仿真设计系统
CN113836607B (zh) * 2021-09-24 2022-05-20 广东工业大学 一种立体仓库的参数化仿真设计方法及其仿真设计系统

Also Published As

Publication number Publication date
CN103246770B (zh) 2015-10-14
US9594543B2 (en) 2017-03-14
US20160283201A1 (en) 2016-09-29
CN103246770A (zh) 2013-08-14

Similar Documents

Publication Publication Date Title
WO2014180106A1 (zh) 一种基于活动图模型的系统行为仿真方法
US9501594B2 (en) Graphical design verification environment generator
CN103336742B (zh) 一种基于Android的自动化软件黑盒测试系统及方法
CN105739983B (zh) 脚本程序编辑装置及其实现方法
Baker et al. Model-driven engineering in a large industrial context—Motorola case study
CN106021816B (zh) 一种基于行为树的分布式系统行为仿真分析工具的实现方法
CN107783758B (zh) 一种智能合约工程方法
CN109858019A (zh) 对话状态跟踪方法及装置、存储介质及语义识别系统
CN111274142B (zh) 一种基于扩展有限状态机的软件通信体系架构符合性测试建模方法
CN105302549A (zh) 一种支持多语言的测试流程生成、调试、执行系统
CN109299530A (zh) 一种仿真测试案例生成方法、系统、存储介质和终端
Amirat et al. Automatic generation of PROMELA code from sequence diagram with imbricate combined fragments
CN103514331A (zh) 一种从Simulink模型转换至UML模型的方法
CN116090380A (zh) 数字集成电路验证的自动化方法及装置、存储介质和终端
CN111767035A (zh) 基于OpenAPI的应用接口对接方法及装置
CN116432573A (zh) 性能仿真方法及电子设备和存储介质
Maneerat et al. Translation UML activity diagram into colored Petri net with inscription
CN113987764A (zh) 一种基于sca域描述文件的仿真模型构建方法及系统
JP2013503408A (ja) ハイブリッド微分代数プロセスモデルの状態量を計算する方法およびプロセス計算機
Machado et al. Automatic test-case generation
Ceco et al. Test bed for network protocols optimization
Matsuura et al. Automatic Verification of Behavior of UML Requirements Specifications using Model Checking.
CN114429051B (zh) 数据流芯片的建模方法、装置、设备及介质
Marquez et al. A unified sequential equivalence checking approach to verify high-level functionality and protocol specification implementations in RTL designs
CN109933880B (zh) 基于配置驱动的SoC原型验证用例提取模型建模方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13884134

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 14442653

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13884134

Country of ref document: EP

Kind code of ref document: A1