开始配置Jenkins了,脚本用TestNG+Java+Selenium
1、输入网址,登陆Jenkins
2、系统设置
2.1下载插件
点击"系统管理-管理插件",进入到插件管理界面,点击“可选插件”
搜索"testng"
点击“立即安装”
搜索“HTML Publisher plugin”
点击“立即安装”
安装“Email Extension Plugin”
如果以上插件没有搜索到,可以看一下“已安装”插件内
2.2 设置JDK 、Ant
一般可以选择“系统管理”--“系统设置”可以找到如下界面
由于我安装的版本是2.78,在“系统设置”里没有这两项转移到“系统管理”--“Global Tool Configuration”里了
别名:随表叫,当然叫蓝洁灵都没人管你(最好叫个规范点的,以后自己也知道。)
JAVA_HOME:写在服务器配置时填写的JAVA_HOME
Ant的配置和JDK一样,
ANT_HOME:写在服务器配置时填写的ANT_HOME
3、配置项目环境
3.1
点击“新建”,随便输个项目名称,选择“构建一个自由风格的软件项目”
点击“ok”按钮,进入下边的界面
3.2
随便写个项目描述
选择“丢弃旧构建”,因为以后要做回归测试,每次都要保存构建内容的话,可能要占用一定的磁盘空间,天数根据需求活业务情况写
我写的是“5”,说明超过30天的构建就不要了,如果填写构建的最大个数是100,说明超过100轮的构建就不要了
3.3
源码管理
配置SVN,Repository URL填写项目源码放在SVN的位置
为了后面构建成功,点击Repository URL后的“?”进行强制认证一下,点击“this link”
输入Repository URL,username,password。点击“ok”,提示认证成功
3.4
构建触发器,是指源码满足什么条件时触发
选择Build periodically,设置日程表。下图的意思是,每天晚上9点开始运行
关于日程表的规则
MINUTE Minutes within the hour (0–59)
HOUR The hour of the day (0–23)
DOM The day of the month (1–31)
MONTH The month (1–12)
DOW The day of the week (0–7) where 0 and 7 are Sunday.
To specify multiple values for one field, the following operators are available. In the order of precedence,
* specifies all valid values
M-N specifies a range of values
M-N/X or */X steps by intervals of X through the specified range or whole valid range
A,B,...,Z enumerates multiple values
Examples:
# every fifteen minutes (perhaps at :07, :22, :37, :52)
H/15 * * * *
# every ten minutes in the first half of every hour (three times, perhaps at :04, :14, :24)
H(0-29)/10 * * * *
# once every two hours at 45 minutes past the hour starting at 9:45 AM and finishing at 3:45 PM every weekday.
45 9-16/2 * * 1-5
# once in every two hours slot between 9 AM and 5 PM every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM)
H H(9-16)/2 * * 1-5
# once a day on the 1st and 15th of every month except December
H H 1,15 1-11 *
3.5
构建环境,勾选“With Ant"
构建,点击”增加构建步骤“选择”Invoke Ant",选择构建的ant
3.6
构建后操作,是指在构建后需要输出测试报告,