gpt4 book ai didi

selenium - 如何生成带有历史信息的诱惑报告。

转载 作者:行者123 更新时间:2023-12-02 18:06:10 25 4
gpt4 key购买 nike

我有一个 bash 脚本可以在 docker 中运行 selenium 测试用例。这个脚本的最后一步是生成测试结果的诱惑报告,例如:

 export ALLURE_IMAGE=beeete2/docker-allure2
export PROJECT_DIR=selenium-suites
export ALLURE_REPORT_DIR=allure-report
export ALLURE_CONFIG_DIR=allure-config
docker run --rm \
-v $(pwd)/$ALLURE_REPORT_DIR:/$ALLURE_REPORT_DIR \
-v $(pwd)/$PROJECT_DIR/$ALLURE_RESULTS_DIR:/$ALLURE_RESULTS_DIR \
-v $(pwd)/$PROJECT_DIR/$ALLURE_CONFIG_DIR:/$ALLURE_CONFIG_DIR \
$ALLURE_IMAGE allure generate /$ALLURE_RESULTS_DIR -o /$ALLURE_REPORT_DIR --clean

如果报告是第一次创建,这个 allure-report 目录将被创建,整个目录结构如下:

├── allure-report
│   ├── app.js
│   ├── data
│   ├── export
│   ├── favicon.ico
│   ├── history
│   ├── index.html
│   ├── plugins
│   ├── styles.css
│   └── widgets
├── selenium-suites
│   ├── allure-config
│   ├── ...

我想知道如果我第二次或第三次运行脚本并创建最新的诱惑报告,我该如何保留以前的历史记录?

我已经用谷歌搜索并发现我应该在下一次执行开始之前将历史部分保存在一个单独的 allure-results 目录中,例如:

if [[ -e ./allure-report/history ]]; then
if [[ -e ./allure-results/history ]]; then
rm -rf ./allure-results/history
fi
mv ./allure-report/history ./allure-results/history
fi

通过这个,它会尝试将最新的allure-report/history部分保存到allure-results/history中,但我不确定下一次执行是什么时候完成,即将在 allure-report 下创建一个新报告,它怎么知道在 allure-results/... 下保存了历史记录?

最佳答案

您需要做的只是复制(和替换)历史文件夹的内容

  • 来自: Allure 报告/历史/
  • to: allure-results/history/

当然,您需要根据项目结构指定文件夹的位置。

一旦你运行 allure generate,它会获取上次运行的文件,还会搜索历史文件(路径:allure-results/history)

生成报告后,allure 将新文件发布到 allure-report 文件夹中,并将所有以前的运行再次分组到历史文件中(allure-report/history/)

关于selenium - 如何生成带有历史信息的诱惑报告。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53088655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com