Jenkins automated testing _02_ the python project & task to set the timing

Foreword

After writing automated test scripts, the ultimate goal is to continue to set. Continuous integration can be achieved several times a day deployment run automated scripts to function constantly monitors the test. Xiao Bian using an automated scripts written in python, here only to explain how under the python project in Jenkins and add regular tasks.

Configuration python environment

Home Click System Management Manage Jenkins

Click the global variable Global Tool Configuration

Configuration python path:

  • The default setting, modify the default global setting for the Setting file in filesystem
  • Enter the python path

Create a task python

? Jenkins Workbench home page, click the "New Item"

Enter the name of the task -> Click "Freestyle project" 

 Project Configuration

Set automatic pulling of git 

Project management addresses on the source selection Git-> input github

Add git user name and password (private projects need to add a user name and password, public programs do not add)

Setting regular tasks

Click trigger Construction -> Construction of checking the timing Poll SCM-> Set input time

Date Format: * * * * * * (respectively timeshare weeks sun and the moon, separated by a space)

Common timing setting:

1. Construction of every 30 minutes

  H/30 * * * *

2. Construction of once every 2 hours

  H H/2 * * *

3. 8:00 every morning to build a

  0 8 * * *

4.8 every day, 12:00, 18:00 were constructed (one day build multiple set) a

  0 8,12,18 * * *

 Configured to perform file

Click constructed -> Add build step check Execute shell-> Input execute the command "python3 xxx.py" (running python file)

 Note: The file small series performed directly in the project root directory, you can directly execute the target file. If the target file is not in the root directory, you need to fill in a relative path.

Example:

1. The target executable file directly in the root directory of the project:

 Execute command: python3 runner.py

2. The goal is not directly executable file in the root directory:

 Execute command: python3 run / runner.py

Building project

进入项目下,点击构建Build Now

 备注:添加定时任务的项目,可在定时时间自动构建

 

Guess you like

Origin www.cnblogs.com/mini-monkey/p/11962239.html