升级allure,从2.22.0更新为2.34.1,增加日志输出
This commit is contained in:
@@ -13,13 +13,14 @@ RUN apt-get update && apt-get install -y default-jdk
|
||||
# 安装git
|
||||
RUN apt-get install -y git
|
||||
|
||||
# 克隆代码
|
||||
# # 克隆代码(即使挂载整个项目目录也需要拉取代码,allure html报告需要确保容器内项目目录下存在lib/allure_xxx/bin/allure文件)
|
||||
RUN git clone --recurse-submodules https://gitlink.org.cn/kytest/apiautotest.git
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /apiautotest
|
||||
COPY . .
|
||||
RUN git rev-parse HEAD
|
||||
RUN ls -a lib && ls -a lib/allure-2.34.1/bin
|
||||
|
||||
# 安装pipenv
|
||||
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv
|
||||
|
||||
62
files/gen_allure.py
Normal file
62
files/gen_allure.py
Normal file
@@ -0,0 +1,62 @@
|
||||
import subprocess
|
||||
|
||||
def generate_allure_report(**kwargs):
|
||||
"""
|
||||
通过allure生成html测试报告,并对报告进行美化
|
||||
"""
|
||||
allure_results_dir = kwargs.get("allure_results")
|
||||
allure_report_dir = kwargs.get("allure_report")
|
||||
# ----------------判断运行的平台,是linux还是windows,执行不同的allure命令----------------
|
||||
cmd = f"{PlatformHandle().allure} generate {allure_results_dir} -o {allure_report_dir} --clean"
|
||||
|
||||
try:
|
||||
# subprocess.run 会等待命令执行完成
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
shell=True, # 允许字符串命令
|
||||
check=True, # 出错会抛异常
|
||||
stdout=subprocess.PIPE, # 捕获标准输出
|
||||
stderr=subprocess.PIPE, # 捕获错误输出
|
||||
text=True # 输出为字符串(而不是字节)
|
||||
)
|
||||
print(result.stdout) # 正常日志
|
||||
if result.stderr:
|
||||
print("⚠️ Allure 生成报告时有警告/错误:")
|
||||
print(result.stderr)
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("❌ Allure 报告生成失败!")
|
||||
print("命令:", e.cmd)
|
||||
print("返回码:", e.returncode)
|
||||
print("错误输出:", e.stderr)
|
||||
raise # 把异常抛出去,外层能感知失败
|
||||
|
||||
# ----------------美化allure测试报告 ------------------------------------------
|
||||
allure_beautiful = AllureReportBeautiful(
|
||||
allure_html_path=allure_report_dir, allure_results_path=allure_results_dir
|
||||
)
|
||||
|
||||
# 设置报告窗口的标题
|
||||
allure_beautiful.set_windows_title(new_title=kwargs.get("windows_title"))
|
||||
|
||||
# 修改Allure报告Overview的标题文案
|
||||
allure_beautiful.set_report_name(new_name=kwargs.get("report_name"))
|
||||
|
||||
# 在allure-html报告中往widgets/environment.json中写入环境信息
|
||||
allure_beautiful.set_report_env_on_html(env_info=kwargs.get("env_info"))
|
||||
|
||||
# ----------------压缩allure测试报告,方便后续发送压缩包------------------------------------------
|
||||
allure_config_path = kwargs.get("allure_config_path") # 保存http_server.exe及双击打开Allure报告.bat的目录
|
||||
copy_file(
|
||||
src_file_path=os.path.join(allure_config_path, [i for i in os.listdir(allure_config_path) if i.endswith(".exe")][0]),
|
||||
dest_dir_path=allure_report_dir,
|
||||
)
|
||||
copy_file(
|
||||
src_file_path=os.path.join(allure_config_path, [i for i in os.listdir(allure_config_path) if i.endswith(".bat")][0]),
|
||||
dest_dir_path=allure_report_dir,
|
||||
)
|
||||
|
||||
attachment_path = kwargs.get("attachment_path") # allure报告压缩的路径,例如:report/allure_report.zip
|
||||
zip_file(in_path=allure_report_dir, out_path=attachment_path)
|
||||
|
||||
return allure_report_dir, attachment_path
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,11 +0,0 @@
|
||||
.side-nav__brand {
|
||||
background: url('logo.svg') no-repeat left center !important;
|
||||
margin-left: 10px;
|
||||
height: 65px;
|
||||
width: 150px;
|
||||
background-size: contain !important;
|
||||
}
|
||||
.side-nav__brand span{
|
||||
display: none;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,13 +80,11 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
export APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit
|
||||
|
||||
APP_NAME="allure"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and ALLURE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
export APP_HOME=$( cd "${APP_HOME:-./}.." > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $ALLURE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and ALLURE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
-classpath "$CLASSPATH" \
|
||||
@@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%..
|
||||
|
||||
BIN
lib/allure-2.34.1/lib/allure-commandline-2.34.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/allure-commandline-2.34.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/allure-generator-2.34.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/allure-generator-2.34.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/allure-model-2.29.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/allure-model-2.29.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/allure-plugin-api-2.34.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/allure-plugin-api-2.34.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/commons-beanutils-1.11.0.jar
Normal file
BIN
lib/allure-2.34.1/lib/commons-beanutils-1.11.0.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/commons-collections4-4.5.0.jar
Normal file
BIN
lib/allure-2.34.1/lib/commons-collections4-4.5.0.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/commons-io-2.19.0.jar
Normal file
BIN
lib/allure-2.34.1/lib/commons-io-2.19.0.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/commons-lang3-3.17.0.jar
Normal file
BIN
lib/allure-2.34.1/lib/commons-lang3-3.17.0.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/commons-logging-1.3.5.jar
Normal file
BIN
lib/allure-2.34.1/lib/commons-logging-1.3.5.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/commons-text-1.11.0.jar
Normal file
BIN
lib/allure-2.34.1/lib/commons-text-1.11.0.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/freemarker-2.3.34.jar
Normal file
BIN
lib/allure-2.34.1/lib/freemarker-2.3.34.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/jackson-annotations-2.19.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/jackson-annotations-2.19.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/jackson-core-2.19.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/jackson-core-2.19.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/jackson-databind-2.19.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/jackson-databind-2.19.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/jackson-dataformat-xml-2.19.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/jackson-dataformat-xml-2.19.1.jar
Normal file
Binary file not shown.
BIN
lib/allure-2.34.1/lib/jackson-dataformat-yaml-2.19.1.jar
Normal file
BIN
lib/allure-2.34.1/lib/jackson-dataformat-yaml-2.19.1.jar
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user