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

标签 selenium docker testng allure

我有一个 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/

相关文章:

python - 使用 Selenium Python 保存大型 html 文件时出现 WebDriverException : Message: Exception. .. "Failure"nsresult: "0x80004005 (NS_ERROR_FAILURE)"

java - "unknown error"、 "message": "connection refused", "stacktrace"尝试在 Mac OS X 上通过 GeckoDriver 和 Selenium 使用 firefoxprofile

selenium - TestNG:通过 testng 运行测试时为 "No tests were found"

excel - 使用 SendKeys 时元素无法与 Selenium Excel VBA 交互

python - 使用python和selenium删除我在reddit中的评论

amazon-web-services - 运行 lambda 函数时无法加载共享库 'libgdiplus' 或其依赖项之一

python-3.x - 谷歌云 : Choosing the right storage option

docker - 在nfs挂载上运行的Docker导致无法复制和无法穿梭

java - Spring + TestNG 不事务回滚

testng - 在 TestNg 软断言中显示 assertEquals 错误消息以及给定自定义消息的任何方式