1、制作 jmeter 运行环境基础镜像
• 下载 jmeter、jre
• 编辑 Dockerfile,
• 推送到 gitlab,
• 阿里云镜像中心构建基础镜像
FROM debian:latest
LABEL name = "***"
RUN apt-get update -y
ADD apache-jmeter /opt/jmeter/
ADD jre /opt/jre
RUN chmod 777 /opt/jmeter/bin/jmeter \
&& ln -s /opt/jmeter/bin/jmeter /usr/local/bin/jmeter \
&& chmod 777 /opt/jre/bin/java \
&& ln -s /opt/jre/bin/java /usr/local/bin/java
WORKDIR /workspace
CMD ["/bin/bash"]
2、编写接口测试计划
• 使用 jmeter 根据业务场景编辑接口测试计划
• 编写 Dockerfile
• 推送到 gitlab
FROM registry.cn-hangzhou.aliyuncs.com/***/jmeter:latest
LABEL name = "***"
ADD case /workspace
CMD ["jmeter","-n","-t","hmwc.jmx","-l","hmwc.jtl","-e","-o","/workspace/report"]
3、创建测试 job 并查看结果
• 创建 job 构建测试镜像,推送镜像到私有仓库
• 创建 job 定时执行测试任务,查看执行结果