Jenkins integrated robotframework

The concept of continuous integration

Continuous Integration (CI) is a practice that enables teams to receive feedback on an ongoing basis and make improvements, do not have to wait until after the development cycle to find and fix defects.

There are several aspects of its benefits:

● errors quickly: every little update is completed, it is integrated into the trunk code, you can quickly find errors, positioning errors is relatively easy.

● prevent substantial deviation from the trunk branch: If it is not often integrated, skeleton code and is continually updated, will lead to the future integration of difficulty increases, even difficult to integrate.

● reduce repetitive work: You can compile, deployment, testing and other actions have become automated through automated continuous integration, without too much manual intervention.

Deployment job lines, so that an application from the build, deploy, test, and release automate this process is the core component of the modern concept of DevOps. In different internal business, the specific implementation of the deployment pipeline is not the same, but the basic principle is the same.

General common line: submit code -> static code scanning -> unit testing -> compiler package -> Automatic Deployment -> Interface test automation -> UI test automation -> Publish the production environment -> User validation phase

  • Deployment:

      1, trigger construct: the development environment for the deployment, a developer code or merge code to push master branch svn project, Jenkins to the corresponding server code is deployed.

      2, the parameters of the building: pre-wired for a test environment deployment environment, develop code or push to the master branch svn merge code after the project, and will not deploy code, but jenkins need to log into the web interface, click on the build button, biography the corresponding parameters (such parameters need to build tag, you need to deploy a branch) and before deployment.

      3, time to build: for automatic packaging, the timing is based on parametric building built on to add, developers can log incoming jenkins manually tag is packaged, if not manually packed, so get the latest from the SVN jenkins pull it every morning the code package.

The basic configuration of continuous integration

This whole idea of ​​the deployment environment technical solutions: SVN + RF + Jenkins + nginx + cenos7 + Allure

  • New node
  1. System Administration -> Node Manager -> New node 
  2. VM cetnos system deployment Jenkins platform, master master node management sub-nodes, because the project is a windows environment is performed based on the use case, you need to add a child node windows environment, of course, also be added based on the linux environment sub-node, depending on the operation of the project environment set.
  3. Add a child node can be a physical machine or a virtual machine.
  4. The action tag corresponding to the tag of each child node which hosts which host Station Idle calls automatically performed Construction

 

New child nodes, the platform will be prompted to download the slave-agent.jnlp child node machine, not through the command line to start the child nodes of child nodes. As shown below:

Here by opening the Control Panel JAVA script starts running, the child node slave-windows become online. As shown below:

  • New job

Here the freedom to choose the style software project, and then set the job task name.

  • General Configuration

Here choose to discard the old construction, constructed to maintain the number of days to build three days, the maximum number of three, arranged to limit operation of the node label robot, other parameters depending on the actual items and more environment.

  • Source Management
  1. Set SVN repository path and account password
  2. Other default, other parameters can also be configured according to the actual situation

  • Trigger builder

● Construction of a timing point of time represented by the set automatically trigger a build

● polling SCM submit code indicating the detection to SVN and automatically trigger a build, this setting every 5 minutes SVN detection state as long as the state change trigger after 5 minutes Construction

● SVN detection state, need to modify the hook script in SVN repository master server node Jenkins

● Timing task trigger time expression

Using a configuration known UNIX CRON task scheduling tool used. With five fields represent the five different time units (separated by spaces):

Time-moon and day of the week

For example:

02 * * * indicates 2:00 every day

* / 10 * * * * every 10 minutes

45 10 * * 1-5 Monday through Friday 10:45 min execution

  • Construct

● presentation environment is not currently involved in the build environment, depending on the actual project and environment.

● The project is based on windows to perform automation use cases, here select windows batch command, which is automatically issued when constructing command automation use cases

● If the project is running on linux environment, you need to select the option to execute the shell and set the parameters

  • After the build operation

● Path采用相对路径,目录名必须与构建批处理一样目录名

● Robot output设定项目执行后存放的报告路径

● bulid result是指设定阀值

注意:构建后操作输出的结果必须与前图构建的批处理脚本路径要求一致性。

  • 邮件配置

● 这里设置邮件相关参数,可以在此job配置数据,如不设置数据,需使用默认变量的,要在系统管理—>系统配置里面配置好

● 邮件内容样式可以自定义模板,需要使用前端技术编写好

● Attach Build Log:表示接收到邮件含有构建log日志文件

● Attachments:表示接收到邮件含有报告附件文件

这里采用默认方式。

  • 邮件Triggers

● triggers有很多种,我们使用最多的就是success和failure,always表示每次构建都发送邮件

●可以给每个策略选择不同的收件人:
    1、Recipient List :在策略中配置的收件人列表
    2、Developers:发送给检测到的代码修改的开发人员
    3、Requestor:发送给触发这次构建的用户
    4、Clprits:发给引发错误的开发人员

  • 系统管理的邮件全局配置

注意:邮箱的密码必须是授权码,不是邮箱的登录密码。

  • 设置邮件的Triggers

  • 平台展示

  • robotframework报告展示样本

  • Allure报告展示样本

  • 构建后自动发出的邮件接收到的报告样本展示一

  • 构建后自动发出邮件接收到的报告样本展示二

备注:因每个用例执行速度达到毫秒级,所以表格显示的是0分0秒。

 

Guess you like

Origin www.cnblogs.com/yinjia/p/11920556.html