作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2021, Vol. 47 ›› Issue (7): 183-188. doi: 10.19678/j.issn.1000-3428.0058857

• 体系结构与软件技术 • 上一篇    下一篇

基于LSTM的S7协议模糊测试用例生成方法

姜亚光1, 陈曦1,2, 李建彬3, 闫靖晨3, 刘曙元4, 李坤昌3   

  1. 1. 中国软件评测中心, 北京 100044;
    2. 北京大学 软件与微电子学院, 北京 102600;
    3. 华北电力大学 控制与计算机工程学院, 北京 100026;
    4. 国能信控互联技术有限公司, 北京 100039
  • 收稿日期:2020-07-07 修回日期:2020-08-16 发布日期:2020-08-25
  • 作者简介:姜亚光(1985-),女,工程师、硕士,主研方向为工业控制系统质量与安全测评;陈曦,工程师、硕士;李建彬(通信作者),教授;闫靖晨,博士;刘曙元,高级工程师;李坤昌,硕士。
  • 基金资助:
    北京市科委计划项目(Z181100005118016);国家电网公司工作部科技项目(5700-201914241A-0-0-00)。

LSTM-based Fuzzy Test Case Generation Method for S7 Protocol

JIANG Yaguang1, CHEN Xi1,2, LI Jianbin3, YAN Jingchen3, LIU Shuyuan4, LI Kunchang3   

  1. 1. China Software Testing Center, Beijing 100044, China;
    2. School of Software and Microelectronics, Peking University, Beijing 102600, China;
    3. School of Control and Computer Engineering, North China Electric Power University, Beijing 100026, China;
    4. China Energy Information&Control Co., Ltd., Beijing 100039, China
  • Received:2020-07-07 Revised:2020-08-16 Published:2020-08-25

摘要: 基于传统模糊测试框架的S7协议模糊测试技术存在构造困难和代码覆盖率低的问题,对测试效率和质量产生很大影响。借助神经网络模型对数据较强的学习能力和预测能力,提出一种基于长短期记忆(LSTM)神经网络的S7协议模糊测试用例生成方法。将S7协议中的特征值字段分为可变字段和不可变字段,对可变字段进行模糊处理,对不可变字段做固定值操作,进而利用局部模糊实现对S7协议帧各字段的模糊分析,生成有效的测试用例。经过学习,模型可以提取到西门子S7协议的特征,自动产生满足协议结构的测试用例。实验对不同字段进行局部模糊,结果表明,该方法预测出的数据具备真实测试用例的特征,可生成大量对特征字段关联性较大的有效测试用例,提高代码覆盖率。

关键词: 长短期记忆神经网络, S7协议, 模糊测试, 测试用例, 字段

Abstract: The fuzzy test technology for S7 protocol based on the traditional fuzzy test framework is limited by the difficulty in construction and low code coverage,which has a great impact on the test efficiency and quality.Exploiting the strong learning and prediction ability of the neural network model,a Long Short-Term Memory(LSTM) neural network-based method of generating fuzzy test cases for S7 protocol is proposed.The feature value fields in the S7 protocol are categorized into the mutable fields and the immutable fields.The mutable fields are blurred,and the immutable fields are specified with fixed values.And then local fuzzy is used to perform fuzzy analysis on each field of the S7 protocol frame to generate effective test cases.The learned model can extract the features of the Siemens S7 protocol and automatically generate test cases conforming to the protocol structure.Local fuzzy is performed on different fields for experiments,and the results show that the generated data has the features of real test cases.The method can provide a large number of effective test cases with strong correlation with the feature fields,improving the code coverage.

Key words: Long Short-Term Memory(LSTM) neural network, S7 protocol, fuzzy test, test case, field

中图分类号: