jenkins cluster (master-> slave)-allure automated test report deployment

1. Prerequisites

  1. Environment

    1) The jenkins environment has been deployed, including the "global tool configuration" of jenkins.

  2. The simple concepts of master and slave

    1) master: the machine where jenkins is deployed

    2) Slave: Apart from the master, all are slaves, that is, there is only one master, and there can be many slaves. The slave machine does not need to install jenkins, because the connection and transfer between the master and the slave rely on the master to provide a web interface to allow the user to manage the job and slave, and the job can be run on the master machine or can be distributed to each slave carried out.

    You can look at this article for a more detailed explanation. https://www.cnblogs.com/itech/archive/2011/11/11/2245849.html

 

 

Second, my environment

  1. Alibaba Cloud server, Linux CentOS8

  2. Jenkins 2.204.2, deployed on Alibaba Cloud Linux system (in the Jenkins cluster, this is the master)

 

 

Three, deploy allure steps

  1. First download the Allure plugin for jenkins

  [Jenkins homepage]-> [plug-in management]-> 

    This one of mine is already installed.

    

 

    1) Installation method 1: online installation

    

    

      2) Installation method 2: offline package installation

      

 

  

      3) Follow-up: The jenkins upgrade site can be modified into a domestic mirror source, and the download speed will be faster: http://mirror.xmission.com/jenkins/updates/update-center.json

      

 

    2. Install Allure Commandline on the slave machine (that is, the machine you want to use to execute test cases)

    Click to download address

       1) Configure the Allure Commandline of Jenkins: [jenkins homepage]-> [System Management]-> [Global Tool Configuration]

      

 

    3. New node (new slave)

      1) New slave: [jenkins homepage]-> [System Management]-> [Node Management]-> [New Node]

       

 

      2) Fill in the basic information of the slave

      

      If there is no option for java web start: [jenkins homepage]-> [global security configuration]-> [proxy]

      

        

 

     4) Fill in the node attributes

      

    

      At this point, the slave is configured, the next step is to connect the slave

 

  4. Connect the slave

    1) Download related files

    

  

    2) Let this slave connect to the master

    

 

    3) Successful connection

    

 

    4) Connection failure -port: 38683 port error

      If you encounter this error, open the firewall on port 38683 of the server, and on the Alibaba Cloud server, open the firewall on port 38683 in the security group.

 

 

 Fourth, create a job with allure

  1. Create a "folder" and put a special project: [jenkins homepage]-> [new task]

    1)

    

    

    

    2) Fill in the information

    

 

   3) The folder (project) is successfully created

    

 

   2. New job : enter the newly created project-> [item]

    1) New job

    

 

    2) Fill in the job information

    

 

    3) Select the jdk used by the project

    

      

 

 

     4) Source code management. With svn or git, you can pull the code in real time to build. This can be talked about independently

    

 

      5) Build trigger: allure will output some source code of use case data after building

       

      

 

    6) Post-build operation: execute the allure generate command to convert the source code file output by allure to the HTML report

    

      Remarks: About the path problem (very important, easy to understand the path problem reported by allure below)

        slave path == working directory filled in when creating a new slave

        

 

 

        Project path == slave path / workspace / project name

        

 

        The path of this project == project directory + project directory / project name

        

 

      Ok, the catalog is finished. How to refer to directories in the introduction of jenkins

        A: slave is Linux: $ {WORKSPACE}  (strict format)

        B: slave is Windows:% WORKSPACE%   (strict format)

      Therefore, in the batch command --alluredir =% WORKSPACE% result (this is the allure report source code directory)

        A: Allure report source code directory: H: \ jenkins_workspace \ ui_auto_test \ workspace \ Autotest_web_open \ common \ result

        B: HTML report directory of allure: H: \ jenkins_workspace \ ui_auto_test \ workspace \ Autotest_web_open \ common \ report

       

 

       

 

 

 

V. Inspection results

  All important steps are introduced.

  As long as the construction project is over, this interface looks like this.

  1. The overall interface of the project

  

 

  2. Allure report interface

  Note: There is a big pit here. I used the QQ browser to view the allure report in Jenkins, but the allure report always fails to load and keeps going in circles. In fact, it is not a problem with the deployment, but a problem with the QQ browser

    Just open it with Google Chrome, and that ’s it.

  

 

   

 

Guess you like

Origin www.cnblogs.com/mua9102/p/12506280.html