docker - 如何在 docker 环境中运行 selenium 测试 jar 后生成诱惑报告
问题描述
在 docker 容器中运行 selenium 可执行 jar 后,我正在尝试执行诱惑报告。我一直试图让它工作 4 天,有人可以建议我是否遗漏了什么或使用了错误的方法?
到目前为止我所做的和尝试的:
- 使用 dockerfile 构建了 selenium 测试可执行 jar (fatjar)。
- 在构建测试 jar 文件时使用 dockerfile 安装了 allure。
- 在阅读此 Allure 后添加了 AllureJunit4 - 使用 jar 生成 allure-results,该 jar在本地运行时会生成正确的目录,但不会在 docker 中生成目录。
- 检查图像和运行容器
docker exec -it
用于查找allure-results
目录。 - 用于
docker cp
尝试复制我认为可能具有吸引力报告的文件夹。 - 我的 docker 文件中的入口点是
ENTRYPOINT ["java", "-jar", "automation-tests.jar"]
. 因此,当我这样做docker build --tag <tagname> .
并且docker run <tagname>
jar 文件运行并执行时没有错误。
下面是我的 dockerfile 的示例
RUN wget https://chromedriver.storage.googleapis.com/80.0.3987.106/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip
RUN mv chromedriver /usr/bin/chromedriver
RUN chown root:root /usr/bin/chromedriver
RUN chmod +x /usr/bin/chromedriver
RUN wget https://github.com/allure-framework/allure-core/releases/download/allure-core-1.4.24.RC2/allure-commandline.zip && \
unzip allure-commandline.zip && bin/allure && rm allure-commandline.zip
FROM gradle:6.1.1-jdk8 AS sdk
WORKDIR /auto
WORKDIR /auto/build
RUN gradle clean fatJar -x test
FROM runtime AS final
COPY --from=sdk path/to/jar/automation-stuff*.jar ./auto-testing.jar
ENTRYPOINT ["java", "-jar", "auto-testing.jar"]
这些都没有产生任何结果,所以如果有人可以帮助我,我会非常感激。所以只是为了澄清这只是生成魅力报告的一个问题。
解决方案
您可以使用 Allure Docker 服务容器。一旦您的测试生成了诱惑结果,您就可以使用 Allure API 发送它们并查看您的更新报告。 https://github.com/fescobar/allure-docker-service#send-results-through-api
推荐阅读
- c# - 多租户机器人数据存储
- python - 批处理文件中的空白和搁置保存在不同的目录中
- google-apps-script - 仅保存新邮件的附件
- unity3d - Unity 中用于 2D 平台游戏的平滑相机跟随
- mysql - 如何使用文件加载空数据?
- javascript - 当显示大小发生变化时,如何在 React Native 中保持相同大小的视图?
- laravel - Laravel 5.6 Function() 在 route/web.php 中不存在
- javascript - 如何关闭来自不同Angularjs组件的所有模态
- php - PHP:发送请求后登录
- javascript - Angular:为什么我不能使用我的组件的方法作为可观察的回调来更新组件中的属性?