
本科毕业设计(论文)
基于 Selenium 的自动化测试系统设计与实现
Design and implementation of automated testing system
based on Selenium
学 院: 软件学院
专 业: 软件工程
学生姓名: XXX
学 号: XXX
指导教师: XXX
北京交通大学
2016 年 5 月

学士论文版权使用授权书
本学士论文作者完全了解北京交通大学有关保留、使用学士论文的规定。特授权北
京交通大学可以将学士论文的全部或部分内容编入有关数据库进行检索,提供阅览服
务,并采用影印、缩印或扫描等复制手段保存、汇编以供查阅和借阅。
(保密的学位论文在解密后适用本授权说明)
学位论文作者签名: 指导教师签名:
签字日期: 年 月 日 签字日期: 年 月 日

北京交通大学毕业设计(论文) 中文摘要
i
中文摘要
摘要:
近些年来,网络技术不断发展,互联网在全球范围内迅速普及,web 应用也逐渐普
及起来,它已经成为人们生活中不可或缺的一部分。已经涉及金融、医疗、娱乐、购物
等各个方面,给人们的生活带来了极大的便利。同时,人们的关注点也从方便易用、美
观简洁逐渐向安全、稳定、可靠转移。这给软件测试提出了更高的要求。同时,web 应
用有着数据量大、产品迭代快速、需要频繁的回归测试等特点,传统的软件测试并不完
全符合 web 测试的要求,这也大大增加了软件测试的难度。所以,引进 web 自动化测
试是很有必要的。web 自动化测试可以代替测试人员完成大量重复、复杂、枯燥的测试,
保证程序的正确性与可靠性,提高测试效率,保证项目进度。
本文设计与实现了适用于“去哪儿”网度假版块的自动化测试框架,用于网站开发
中大量的回归测试与迭代测试,保证测试进度,减轻测试人员负担。同时,根据完成的
自动化测试框架,开发自动化测试脚本,实现部分测试用例的自动化,完成自动化测试
的任务。
本人的主要工作如下:
1. 分析“去哪儿”网度假版块特点、功能及测试人员对编写测试用例提出的要求,总
结出自动化测试框架的需求分析。
2. 通过分析需求分析,选择适合待测网站的开发语言和自动化测试工具。
3. 参与设计了自动化测试框架的整体架构。框架整体分为 config 层、monitor 层、case
层和 util 层。使用 controller.py 文件来控制整个测试过程,执行测试用例,获得测试
的结果和日志。
4. 根据自动化测试框架的需求分析与整体架构设计,参与实现了自动化测试框架,实
现了部分功能。
5. 根据手动测试的测试用例,完成自动化测试用例的编写,实现 web 测试的自动化。
最终经过几个月的设计与开发,完成了适用于“去哪儿”网度假版块的自动化测试
框架,并完成了部分手动测试用例的脚本化,实现了网站的自动化测试。在自动化测试
实施后,实现了节约测试的成本、减轻测试人员的负担、保证项目的进度与正确性的目
标。
关键词:自动化测试;selenium;自动化测试脚本

北京交通大学毕业设计(论文) 英文摘要
ii
ABSTRACT
ABSTRACT:
In recent years, with the continuous development of network technology and the rapid
popularization of Internet in the global scope, Web applications has become an indispensable
part of people's life. It has been involved in financial, medical, entertainment, shopping and
many other aspects, has brought great convenience to people's life. At the same time, people's
attention is also from the convenient and easy to use, beautiful and simple gradually to the
safe, stable and reliable transfer. This has put forward higher requirements for software testing.
At the same time, the Web application has a large amount of data and the need of rapid
iteration, frequent regression testing, etc, the traditional software testing is not completely
accord with the requirement of Web testing, which greatly increased the difficulty of software
testing. So, the introduction of Web test automation, it is very necessary. Web automation test
can replace the tester with repetitive, complicated and boring test, guarantee the correctness
and reliability of the procedure and improve the test efficiency, guarantee the project
schedule.
This paper designs and implements an automated testing framework, which is suitable for
the ‘qunar’ website’s vacation section. It is used for a lot of regression testing and iterative
testing in website development, to ensure the progress of testing and to reduce the burden of
testing personnel. At the same time, according to complete the automated testing framework,
develop automated test scripts, and realize the automation of part of the test cases, to complete
the automated testing tasks.
My main work is as follows:
1. Analysis "qunar" website’s holiday section characteristics, functions and the tester
needs to write a test case, sums up the requirements analysis of test automation framework.
2. Combined with the demand analysis, select the appropriate Web test automation tool
and the development language.
3. Participated in the design of the overall architecture of the test automation framework.
Framework as a whole is divided into the config layer, monitor layer, and case layer and util
layer. Through the controller files to connect the whole test process, perform the test script,
test results and log.
4. According to the test automation framework of requirements analysis and the overall

北京交通大学毕业设计(论文) 英文摘要
iii
architecture design, participate in the writing of the test automation framework code, can
realize the function part.
5. According to the test case of manual test, write the test script, and realize the
automation of the Web test.
Finally after several months of design and development, the completion of the applicable
to "to where" net holiday plate of automated testing framework, and completed part of the
manual test case scripts, realize the automation of the test site. In the use of the process,
saving the cost of testing, reducing the burden of testing personnel, to ensure the progress of
the project and the right.
KEYWORDS:automation; Selenium; Automated test scripts