Bootstrap

Gitlab CICD 下载artifacts文件并用allure打开,或bat文件打开

allure命令行打开aritfacts报告

首先下载allure.zip,并解压

配置环境变量

使用命令行打开allure文件夹

allure open 2024-03-11-14-54-40

2024-03-11-14-54-40 包含index.html

Bat文件打开artifacts

There are 2 html reports in the download artifacts.zip

  1. Surefire report: \target\surefire-reports index.html, same information as viewed on GitLab

  2. Allure report: \TestReport\yyyy-MM-dd-hh-mm-ss\index.html
    Details including url, method could be seen

    Open image-20230703-032607.png

    (Note: Directly open index.html might not be able to view the report, its possible to place under the same folder as index.html and double click the *.bat, it locates the chrome path and sets --disable-web-security just for viewing the report)

Bat文件复制到和index.html同一个文件夹,然后双击打开即可

bat 内容如下

@echo off
setlocal enabledelayedexpansion

set "chrome_path="
set reg_query_command=reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe" /ve

for /f "tokens=2*" %%A in ('%reg_query_command%') do (
    if "%%A"=="REG_SZ" (
        set "tmp_chrome_path=%%B"
        if exist "!tmp_chrome_path!" (
            set "chrome_path=%%B"
        )
    )
)


if defined chrome_path (
    echo Chrome found at: "%chrome_path%"
    "%chrome_path%" --disable-web-security --user-data-dir="%~dp0/tmp" %~dp0/index.html
) else (
    echo Chrome not found.
    echo start a webserver ...
    start /b http_server.exe -port 5001
    start /WAIT msedge.exe http://127.0.0.1:5001
)

;