Files
smart-management-auto-test/zhyy/test_case/jenkins_build.sh
qiaoxinjiu 6994b185a3 addproject
2026-01-22 19:10:37 +08:00

48 lines
1.2 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Jenkins构建脚本Linux/Mac
# 用于在Jenkins中执行测试并生成Allure报告
set -e # 遇到错误立即退出
# 设置工作目录
cd ${WORKSPACE:-$(pwd)}
# 进入测试目录
cd zhyy/test_case
# 运行测试(根据参数选择运行方式)
RUN_TYPE=${RUN_TYPE:-all}
case ${RUN_TYPE} in
all)
python run_tests.py --all --no-report
;;
feature)
python run_tests.py --feature "${FEATURE_NAME}" --no-report
;;
story)
python run_tests.py --story "${STORY_NAME}" --no-report
;;
dir)
python run_tests.py --dir "${DIR_PATH}" --no-report
;;
file)
python run_tests.py --file "${FILE_PATH}" --no-report
;;
keyword)
python run_tests.py --keyword "${KEYWORD}" --no-report
;;
marker)
python run_tests.py --marker "${MARKER}" --no-report
;;
*)
echo "未知的运行类型: ${RUN_TYPE}"
exit 1
;;
esac
# 生成Allure报告Jenkins插件会自动处理这里可选
# allure generate reports/allure-results -o reports/allure-report --clean || true
echo "测试执行完成Allure结果已保存到: reports/allure-results"