最近给公司搭了个jenkins做CI,步骤总结如下:
1.1 How to use jerkins to trigger an automation test on B2C
- http://10.196.16.210:8080/
- Click build now
- You can see the new build is starting.
- After the build is finished , click the build link url
- Console out is for the test run log
- Cucumber report is the detail report for the selenium run result.
1.2 How to config Jenkins for a cucumber task?
1.2.1. http://10.196.16.210:8080/
Jenkins->Plugin Manager Install Maven Integration plugin
1.2.2 In the Global Tool Configuration, fill in the maven info, eg.
Also the JKD info:
1.2.3 Configure System
Click the Configure System
Config Jenkins location
Fill in the part for “Extended E-mail Notification”
Do remember to check the options for the Default Trigger
1.2.4 Now time to create a new project , click new item and choose Maven project
Proceed to the next page and fill the Source Code Management
Two tasks added after Post-build Actions : Cucumber reports and Editable Email Notification.
Some maven info:
Maven running cucumber command
mvn test -Dcucumber.options="--tags @smoke"
mvn test -Dcucumber.options="--help"
mvn install:install-file -DgroupId="com.oracle" -DartifactId=ojdbc12 -Dversion="12.1.0.1" -Dpackaging=jar -Dfile="D:\B2CGit\Libraries4Automation\selenium-2.53.1\libs\ojdbc6-12.1.0.1-atlassian-hosted.jar" -DgeneratePom=true
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc12</artifactId>
<version>12.1.0.2</version>
</dependency>
Installl Maven:
Check environment variable value e.g.
echo %JAVA_HOME% (I used C:\Program Files\Java\jdk1.8.0_144)
Adding to PATH: Add the unpacked distribution’s bin directory to your user PATH environment variable by opening up the system properties (WinKey + Pause), selecting the “Advanced” tab, and the “Environment Variables” button, then adding or selecting the PATH variable in the user variables with the value D:\apache-maven-3.5.3\bin. The same dialog can be used to set JAVA_HOME to the location of your JDK, e.g. C:\Program Files\Java\jdk1.8.0_144
Open a new command prompt (Winkey + R then type cmd) and run mvn -v to verify the installation.
Reference Link: http://maven.apache.org/install.html