摘要
测试是保证Web应用的高质量、高可靠性的一种有效手段,然而,由于其特殊性和复杂性,使得传统的测试理论与方法很难直接运用到Web应用的测试中,一个关键的问题就是测试用例的生成及其优化。提出了一种将遗传算法用于基于用户会话的Web应用测试用例生成及其优化的方法。通过分析服务器的用户日志,清除无关的数据,得到大量有意义的用户会话,利用约简技术进一步剔除其中的冗余。为便于测试的重用和并发执行,将用户会话进行合理的分组,每一组称为一个测试套件,并在测试套件之间以及测试套件内部(测试用例之间)进行初步的优先排序。这样就得到了初始的测试套件和测试用例,以及它们的初始执行顺序。这种初始的测试方案离最优解的近似程度还不是很高,需进一步利用遗传算法对它们进行分组优化并优先排序。同时提出了一种利用交叉算子产生新的测试用例的方法,新的测试用例可以检测不同用户共享数据时可能带来的冲突而产生的错误。
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.
出处
《计算机科学与探索》
CSCD
2008年第6期627-640,共14页
Journal of Frontiers of Computer Science and Technology
基金
国家自然科学基金
国家重点基础研究发展规划(973)
国家高技术研究发展计划(863)
上海市教委科研项目
上海市重点学科建设项目~~