Computer Engineering and Applications ›› 2011, Vol. 47 ›› Issue (35): 71-76.

• 研发、设计、测试 • Previous Articles     Next Articles

Application of improved LCS method in test scripts sequence compare

ZENG Bo,PAN Shaobin,LU Lu   

  1. School of Computer Science & Engineering,South China University of Technology,Guangzhou 510006,China
  • Received:1900-01-01 Revised:1900-01-01 Online:2011-12-11 Published:2011-12-11

改进的LCS方法在测试脚本序列比对中的应用

曾 波,潘少彬,陆 璐   

  1. 华南理工大学 计算机科学与工程学院,广州 510006

Abstract: In the automated testing,it needs to compare the request sequences between recording and playback.The result of the comparison will help users to correct the test script.In order to realize the request of matching,adopt the Longest Common Sequence(LCS) algorithm for recording and playback sequence of comparison.Its core is converting the sequence compare into the graph problem,finding the optimal matching path through matrix.In this paper,the algorithm and its implementation is described in detail.The performance of the algorithm will be tested and analyzed compared to the traditional LCS method.The algorithm is applied to the software script modifier.The results show that the LCS algorithm can efficiently compare request sequences,and improve the efficiency of automated testing.

Key words: software testing, script modification, sequence compare, Longest Common Sequence algorithm(LCS)

摘要: 在自动化测试中,需要对录制和回放过程中的请求序列进行解析和比对,帮助用户进行脚本的修正和完善。为了实现请求序列的比对,采用最长公共子序列(LCS)算法对录制和回放的序列进行比较,其核心思想是把序列对比转化成图论问题,通过二维矩阵寻路来找到最优的匹配方式。文中对算法的原理和实现做了详细描述,并对算法的性能进行测试和分析,最后将算法应用到软件脚本修改器中,验证算法在自动化测试实际应用中的效果。结果表明,LCS算法可以高效地对序列进行解析和比对,提高了自动化测试的效率。

关键词: 软件测试, 脚本修改, 序列比对, 最长公共子序列算法(LCS)