Journal of Frontiers of Computer Science and Technology ›› 2008, Vol. 2 ›› Issue (6): 627-640.DOI: 10.3778/j.issn.1673-9418.2008.06.006

• 学术研究 • Previous Articles     Next Articles

Test case generation and optimization for Web application test based on user sessions

QIAN Zhongsheng1,2+, MIAO Huaikou1   

  1. 1. School of Computer Engineering & Science, Shanghai University, Shanghai 200072, China
    2. School of Information Technology, Jiangxi University of Finance & Economics, Nanchang 330013, China
  • Received:1900-01-01 Revised:1900-01-01 Online:2008-12-06 Published:2008-12-06
  • Contact: QIAN Zhongsheng

面向用户会话的Web应用测试用例生成及其优化

钱忠胜1,2+,缪淮扣1   

  1. 1. 上海大学 计算机工程与科学学院,上海 200072
    2. 江西财经大学 信息管理学院,南昌 330013
  • 通讯作者: 钱忠胜

Abstract: The test is an effective way to ensure the high quality and high reliability of Web applications. Unfortunately, it is hard to directly employ the traditional test theories and methodologies because of the particularities and complexities of Web applications. The test case generation and optimization is one of the key problems.An approach to generating and optimizing test cases is proposed for Web application test based on user sessions using genetic algorithm. A large volume of meaningful user sessions are obtained after purging their irrelevant information by analyzing user logs on the Web server. Most of the redundant user sessions are also removed by reducing them. For test reuse and test concurrency, it divides the user sessions obtained into different groups, each of which is called a test suite, and then prioritizes the test suites and the test cases of each test suite. So, the initial test suites and test cases, and their initial executing sequences are achieved. However, the test scheme generated by the elementary prioritization is not much approximate to the best one. Therefore, genetic algorithm is employed to optimize the grouping and prioritization. Meanwhile, an approach to generating new test cases is presented using crossover. The new test cases can detect errors caused by the use of possible conflicting data shared by different users.

Key words: Web applications, genetic algorithm, test case, test suite, reduction, prioritization, common prefix

摘要: 测试是保证Web应用的高质量、高可靠性的一种有效手段,然而,由于其特殊性和复杂性,使得传统的测试理论与方法很难直接运用到Web应用的测试中,一个关键的问题就是测试用例的生成及其优化。提出了一种将遗传算法用于基于用户会话的Web应用测试用例生成及其优化的方法。通过分析服务器的用户日志,清除无关的数据,得到大量有意义的用户会话,利用约简技术进一步剔除其中的冗余。为便于测试的重用和并发执行,将用户会话进行合理的分组,每一组称为一个测试套件,并在测试套件之间以及测试套件内部(测试用例之间)进行初步的优先排序。这样就得到了初始的测试套件和测试用例,以及它们的初始执行顺序。这种初始的测试方案离最优解的近似程度还不是很高,需进一步利用遗传算法对它们进行分组优化并优先排序。同时提出了一种利用交叉算子产生新的测试用例的方法,新的测试用例可以检测不同用户共享数据时可能带来的冲突而产生的错误。

关键词: Web应用, 遗传算法, 测试用例, 测试套件, 约简, 优先排序, 公共前缀,