directory
- nonsense
- Reference materials (thanks to information providers)
- Install Jenkins
- Allure plugin installation
- Global Allure
- Install Python
- Create a new task (Freestyle Project)
- Build tasks
- View the results
- other
- Update: Email could not be sent problem resolution
nonsense
I have written a demo of interface automation test before, but I have not done Jenkins before. Recently, I have been half-hearted in my review, so today I will combine this demo with Jenkins and learn about Jenkins by the way
Reference materials (thanks to information providers)
Jenkins: www.jenkins.io/zh/doc/
Jenkins+Pytest+Allure Integrated Testing environment: blog.csdn.net/weixin_3023…
Jenkins: blog.csdn.net/qq_38685141…
Install Jenkins
-
Install Java environment variables: www.cnblogs.com/zy7y/p/1334…
-
Download the Jenkins. War package:
The next two commands need to be executed in the jenkins.war package path with one command selected (note whether the port is open and whether the cloud server is configured with a security group).
-
Run Jenkins with java-jar Jenkins. War –httpPort=8080
-
Nohup java-jar Jenkins. War –httpPort= 8080&
-
Browser access: IP address :8080
-
The first time you run it, you’re going to have to install some plugins and stuff like that
-
After the plug-in is installed, you will be prompted to create an administrator account
Allure plugin installation
Manager Jenkins -> Manage Plugins -> Enter allure in the search bar and click Install directly (Figure 2). It is recommended to restart after installation.
Global Allure
Manage Jenkins – > Global Tool Configuration – > Added Allure…
Install Python
Ps: The demo code is pulled from the Git library, and there is no Venv environment for the code in the Git library, so python will be used to create and install the dependent library
yum -y install python3
Create a new task (Freestyle Project)
-
Click New item: You can fill in the task name and click OK
-
Configuration in the task
-
Source code management (address used in figure: gitee.com/zy7y/apiAut…)
Tests show that each build pulls the latest code from this Git address (and only one copy exists), stored at${WORKSPACE}
A catalogue of Jenkins’ work
-
-
Build: this time I used Linux (centos7) so I used Excute shell
Shell script content:
#Create a virtual environment called VENv python3 -m venv venv #Use the virtual environment source venv/bin/activate #Upgrade PIP pip install --upgrade pip #Install script dependency libraries pip install -r requirements.txt #Running the test automatically finds the test file pytest --alluredir "${WORKSPACE}/allure-results" #exit exit 0 Copy the code
-
After build: Configure Allure (Select Allure Report)
-
Build tasks
View the results
other
In fact, there is a configuration of mail after the build, but for some reason, the mailbox does not receive, and the next article will use pipeline form to create it all together
Update: Email could not be sent problem resolution
www.cnblogs.com/zy7y/p/1345…