【Jenkins】RobotFramework + Jenkins + Allure Report实现自动化测试
1. 官网
https://www.jenkins.io/doc/
https://robotframework.org/
https://docs.qameta.io/allure/#_jenkins
2. 安装allure
https://www.cnblogs.com/fireblackman/p/15819553.html
3. 安装Jenkins
https://www.cnblogs.com/fireblackman/p/15669025.html
4. 安装robotframework及相关插件
ubuntu
sudo pip install robotframework sudo pip install allure-robotframework
5. 创建流水线项目
https://www.cnblogs.com/fireblackman/p/15719426.html
6. 安装配置jenkins allure 插件
https://docs.qameta.io/allure/#_jenkins
7. 编写Jenkins脚本
pipeline { agent any stages { stage('Build') { steps { sh 'echo start build......' } } stage('Test') { steps { sh 'echo wait server start......' checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption', disableSubmodules: true, parentCredentials: false, recursiveSubmodules: false, reference: '', trackingSubmodules: false], [$class: 'RelativeTargetDirectory', relativeTargetDir: 'autotest']], submoduleCfg: [], userRemoteConfigs: [[url: 'http://192.168.10.99/root/autotest.git']]]) sh 'cd ./autotest && ls && sudo apt-get install -y python3-pip && pip3 install -U pip setuptools && pip3 install robotframework allure-robotframework' sh 'pwd' sh 'cd ./autotest && python3 -m robot --listener allure_robotframework --outputdir ./output/robot ./tests/mytest.robot || true' sh 'cd ./autotest && mv ./output/allure ../allure-results' } } stage('Deploy') { steps { sh 'echo deploy deploy........' } } stage('reports') { steps { script { allure([ includeProperties: false, jdk: '', properties: [], reportBuildPolicy: 'ALWAYS', results: [[path: './allure-results']] ]) } } } } }
8. 测试
测试报告
问题1. -bash: robot: command not found
https://blog.csdn.net/zbj18314469395/article/details/122200880
问题2. allure-results does not exist
复制到WORKSPACE下,
sh 'cd ./autotest && mv ./output/allure ../allure-results'
参考链接:
https://www.jianshu.com/p/b99f82c546ef