Appearance
...
Appearance
代码提交自动触发跑用例
git clone https://github.com/xxx/api-test.git
git pull # 拉最新代码
git add . # 添加修改
git commit -m "新增用例" # 提交
git push # 推送pipeline {
agent any
stages {
stage('Checkout') { steps { checkout scm } }
stage('Install') { steps { sh 'pip install -r requirements.txt' } }
stage('Test') { steps { sh 'pytest tests/ --alluredir=./reports' } }
stage('Report') { steps { allure includeProperties: true } }
}
post {
success { sh 'python notify.py --status success' }
failure { sh 'python notify.py --status failed' }
}
}name: API Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- run: pip install -r requirements.txt && pytest tests/ -vdef send_feishu(msg):
url = "https://open.feishu.cn/open-apis/bot/v2/hook/xxx"
requests.post(url, json={"msg_type": "text", "content": {"text": msg}})