第1 部分 持续集成:介绍篇
第1 章 持续集成解决了什么问题 ............................................................................ 2
1.1 提高软件质量 ........................................................................................................ 2
1.2 节约时间,缩短项目发布周期 ............................................................................ 5
1.3 便捷部署 ................................................................................................................ 7
1.4 增强项目的可见性 ................................................................................................ 8
1.5 建立团队对开发产品的信心 ................................................................................ 9
1.6 解决项目管理的困惑 .......................................................................................... 10
1.7 总结 ...................................................................................................................... 11
第2 章 何谓持续集成 .............................................................................................. 12
2.1 持续集成的定义 .................................................................................................. 12
2.2 持续集成的特点 .................................................................................................. 12
2.3 原则 ...................................................................................................................... 15
2.4 总结 ...................................................................................................................... 17
第3 章 持续集成的核心价值 .................................................................................. 18
3.1 价值点 .................................................................................................................. 18
3.2 减少风险 .............................................................................................................. 19
3.3 根据变更构建软件 .............................................................................................. 20
3.4 总结 ...................................................................................................................... 22
第4 章 持续集成实践步骤 ...................................................................................... 23
4.1 如何选取最佳解决方案 ...................................................................................... 23
4.2 持续集成实践计划 .............................................................................................. 26
4.3 持续集成实践风险 .............................................................................................. 31
4.4 总结 .................................................................................................................... 32
第5 章 持续集成如何实施 .................................................................................... 33
5.1 场景一:Jenkins+版本控制 ............................................................................... 33
5.2 场景二:Jenkins+Selenium ................................................................................ 37
5.3 场景三:Jenkins+Android .................................................................................. 43
5.4 场景四:Jenkins+GitHub .................................................................................... 52
5.5 总结 .................................................................................................................... 58
第2 部分 持续集成:玩转Jenkins
第6 章 持续集成工具Jenkins ................................................................................. 62
6.1 持续集成工具介绍 ............................................................................................. 62
6.2 为什么选用Jenkins ............................................................................................. 68
6.3 Jenkins 简介 ........................................................................................................ 69
6.4 总结 ..................................................................................................................... 71
第7 章 搭建Jenkins 环境 ...................................................................................... 72
7.1 Jenkins 的官网地址 ............................................................................................ 72
7.2 安装环境 ............................................................................................................. 72
7.3 在Windows 系统中安装Jenkins ....................................................................... 78
7.4 在Linux 系统中安装Jenkins .............................................................................. 79
7.5 Jenkins 的目录结构 ............................................................................................ 80
7.6 总结 ..................................................................................................................... 81
第8 章 Jenkins 的系统配置及使用说明 ................................................................ 82
8.1 Jenkins 的系统配置 ............................................................................................. 82
8.2 插件管理 .............................................................................................................. 89
8.3 权限设置 .............................................................................................................. 89
8.4 Jenkins 中slave 节点的应用 ............................................................................... 92
8.5 新建一个构建 ...................................................................................................... 93
8.6 控制台操作 ......................................................................................................... 100
8.7 例子 ..................................................................................................................... 104
8.8 Jenkins 维护之升级 ............................................................................................ 110
8.9 Jenkins 维护之备份 ............................................................................................ 111
8.10 总结 .................................................................................................................. 113
第9 章 Jenkins 与Ant、Maven 结合 ................................................................... 114
9.1 Ant 简介 ............................................................................................................. 114
9.2 在Jenkins 中配置Ant 环境 ............................................................................. 114
9.3 用Ant 构建项目 ................................................................................................ 115
9.4 Ant 的常用命令 .................................................................................................. 116
9.5 Maven 介绍 ......................................................................................................... 118
9.5.1 Maven 简介 ...................................................................................................... 118
9.5.2 Maven 的安装 .................................................................................................. 119
9.5.3 Maven 坐标详解 .............................................................................................. 120
9.5.4 Maven 的生命周期与命令行 .......................................................................... 122
9.6 在Jenkins 中配置Maven 环境 ......................................................................... 124
9.7 用Maven 构建项目 ........................................................................................... 125
9.8 总结 ..................................................................................................................... 127
第10 章 持续评审、持续部署与持续反馈 .......................................................... 128
10.1 在Jenkins 中配置Checkstyle .......................................................................... 128
10.2 在Jenkins 中配置FindBugs ............................................................................. 129
10.3 在Jenkins 中配置Publish over SSH ................................................................. 132
10.4 在Jenkins 中配置Weblogic 项目的部署 ...................................................... 134
10.5 在Jenkins 中配置Tomcat 项目的部署 ......................................................... 135
10.6 Jenkins 中邮件的配置 ..................................................................................... 136
10.7 配置构建完成后自动发送邮件 ...................................................................... 142
10.8 总结 .................................................................................................................. 144
第3 部分 自动化测试篇:Jenkins+Selenium
第11 章 自动化测试工具之Selenium ................................................................... 146
11.1 Selenium 的定义 .............................................................................................. 147
11.1.1 自动化测试的定义 ....................................................................................... 147
11.1.2 Selenium 是优秀的Web 测试工具 ............................................................. 148
11.2 Selenium 1.0 与Selenium 2.0 ............................................................................ 148
11.3 浏览器的支持 ................................................................................................... 149
11.4 Selenium RC 的原理 .......................................................................................... 150
11.5 Firefox 的安装 ................................................................................................... 150
11.6 Selenium IDE 的安装 ......................................................................................... 151
11.7 Firebug ................................................................................................................. 152
11.7.1 Firebug 简介 ............................................................................... ................... 152
11.7.2 Firebug 的安装 ........................................................................... ................... 153
11.7.3 Firebug 定位页面元素 ............................................................ .... .................. 154
11.8 Java 开发环境的配置 ................................................................. ...................... 156
11.9 Eclipse ............................................................................................. ..................... 158
11.9.1 Eclipse 简介 ........................................................................... .... .................... 158
11.9.2 Eclipse 的安装 ....................................................................... .... .................... 159
11.9.3 Eclipse 的常用快捷键 ...................................................... .... ......................... 159
11.10 Eclipse 插件安装 .............................................................................................. 160
第12 章 Selenium入门 ............................................................................................ 163
12.1 Selenium IDE 的用法 ......................................................................................... 163
12.1.1 Selenium IDE 脚本的录制与回放 .................................................................. 163
12.1.2 Selenium IDE 脚本的调试 .............................................................................. 164
12.1.3 Selenium IDE 脚本的导出 .............................................................................. 166
12.2 XPath 的简介与应用 ......................................................................................... 169
12.2.1 XPath 简介 ...................................................................................................... 169
12.2.2 XPath 中节点的定位 ...................................................................................... 171
12.3 Selenium 2.0 基础 ............................................................................................. 172
12.3.1 下载Selenium lib 包 ..................................................................................... 172
12.3.2 打开浏览器 .................................................................................................... 173
12.3.3 打开测试页面 ................................................................................................ 173
12.4 如何在Selenium 中查找与定位页面元素 ..................................................... 174
12.4.1 By ID ................................................................................................................. 174
12.4.2 By Name ........................................................................................................... 174
12.4.3 By className ............................................................................................... 174
12.4.4 By XPath ....................................................................................................... 174
12.5 Selenium 如何操作页面元素 ....................................................................... 175
12.5.1 输入框 ...................................................................................... ................. 175
12.5.2 按钮 ....................................................................................... .................... 175
12.5.3 下拉选择框 ......................................................................... ...................... 175
12.5.4 弹出对话框 .......................................................... ..................................... 176
12.5.5 导航 ................................................................ ........................................... 176
12.5.6 上传文件 ...................................................... ............................................. 176
12.5.7 拖曳 ................................................................... ........................................ 177
12.5.8 双击 .............................................................. ............................................. 177
12.5.9 右键菜单 ................................................................ ................................... 177
12.6 高级应用 ....................................................................................................... 177
12.6.1 读取Cookie ............................................................... ................................. 177
12.6.2 调用JavaScript ................................................................. .......................... 178
12.6.3 截图 ........................................................................................ ................... 178
12.6.4 页面的隐式等待 ......................................................................... .............. 178
12.6.5 页面的显式等待 .............................................................................. ......... 178
12.6.6 设置profile 属性 ................................................................................. ..... 179
12.7 其他 ............................................................................................................... 179
第13 章 基于Selenium 封装的测试框架 .......................................................... 180
13.1 框架简介 ........................................................................................................ 180
13.1.1 框架特色 ..................................................................................................... 181
13.2 浏览器支持 .................................................................................................... 181
13.2.1 Firefox ............................................................................................................ 182
13.2.2 IE .................................................................................................................... 182
13.3 Maven 管理 .................................................................................................... 183
13.4 TestNG 工具 ................................................................................................... 184
13.4.1 监听 ............................................................................................................ 187
13.5 关键字驱动 .................................................................................................... 192
13.6 报告 ................................................................................................................ 193
13.6.1 日志 ............................................................................................................. 193
13.6.2 结果统计 ..................................................................................................... 197
13.7 其他功能 ........................................................................................................ 201
13.7.1 高亮 ............................................................................................................. 201
13.7.2 智能提醒 ..................................................................................................... 202
第14 章 自动化测试持续集成 ............................................................................ 204
14.1 持续集成的基础配置 .................................................................................... 204
14.1.1 选择JDK 的版本 ........................................................................................ 204
14.1.2 配置源码管理方式 ......................................................... ........................... 204
14.1.3 测试频率 ............................................................................ ........................ 205
14.1.4 配置Maven ........................................................................ ......................... 206
14.1.5 Windows 批处理命令设置 ............................................ ............................ 206
14.2 分布式测试执行 ............................................................................................ 208
14.3 测试报告集成 ............................................................................................... 210
附录A 技能储备 ................................................................................................... 227
附录B 持续集成相关资源 ................................................................................... 228
附录C 名词解释 ................................................................................................... 230
后记 ........................................................................................................................ 234
· · · · · · (
收起)