1. JOB project configuration
1. Add description
Optional options can be filled in or left blank
2. Limit the running nodes of the project
The node must have the configuration required for the running environment
Node configuration tutorial:https://blog.csdn.net/YZL40514131/article/ details/131504280
3. Source code management
Need to push the script to the remote warehouse
4. Build triggers
You can choose scheduled construction andpollingSCM
-
Scheduled build: Automatically execute scheduled tasks according to the set scheduled time
-
Polling SCM: When the code in the remote warehouse changes, the automation code will be automatically executed
5. Construction steps
-
a. python -m pytest ${methods} --alluredir=./reports --clean-alluredir: ${methods} gets the parameters passed during the parameterized build process, the default is testcases
-
b. The current path is /root/jenkins_mulu/workspace/test_backend
-
c. workspace: the job name is the project name
6. Post-build operations
Special note: keep names consistent
Install the plug-in Post Build task for shell execution after generating the report
python3 send_ding.py "${JOB_BASE_NAME}": Pass the parameter "${JOB_BASE_NAME}" to the send_ding.py file. JOB_BASE_NAME: indicates the job name
Send_ding.py needs to use sys.argv[1] to receive. When the job is built, perform post-build operations, generate test reports and send DingTalk notifications.
Finally, I would like to thank everyone who read my article carefully. Looking at the increase in fans and attention, there is always some courtesy. Although it is not a very valuable thing, if you can use it, you can take it directly!