
newman-runner是一个基于Newman的CI/CD工具,专为devops-system测试功能设计。该工具能够从指定的API服务器(https://github.com/iii-org/devops-system%EF%BC%89%E8%8E%B7%E5%8F%96%E6%95%B0%E6%8D%AE%EF%BC%8C%E6%89%A7%E8%A1%8CNewman%E6%B5%8B%E8%AF%95%EF%BC%8C%E5%B9%B6%E5%B0%86%E6%B5%8B%E8%AF%95%E7%BB%93%E6%9E%9C%E6%8E%A8%E9%80%81%E5%9B%9EAPI%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%8C%E5%AE%9E%E7%8E%B0%E6%B5%8B%E8%AF%95%E6%B5%81%E7%A8%8B%E7%9A%84%E8%87%AA%E5%8A%A8%E5%8C%96%E3%80%82
适用于devops流程中的自动化测试环节,特别是需要对API服务进行持续集成测试的场景,可嵌入CI/CD流水线实现测试自动化。
bashdocker pull iiiorg/newman-runner
bash# 创建符号链接指向待扫描目录 ln -s <需要扫描的目录> repo # 运行容器 docker run \ --env username=<API服务器用户名> \ --env password=<API服务器密码> \ --env git_url=http://10.50.1.53/root/rotest.git \ # GitLab仓库的.git URL --env api_origin=http://127.0.0.1:10009 \ # API服务器地址 --env test_origin=http://127.0.0.1:10010 \ # 待测试服务器地址 --env git_branch=master \ # 测试分支名称 --env git_commit_id=aec8d49b \ # 测试提交ID iiiorg/newman-runner
bash# 使用.env文件配置环境变量 docker run --env-file=.env iiiorg/newman-runner
| 环境变量 | 说明 |
|---|---|
| username | API服务器登录用户名 |
| password | API服务器登录密码 |
| git_url | GitLab仓库的.git URL |
| api_origin | API服务器地址 |
| test_origin | 待测试服务器地址 |
| git_branch | 测试分支名称 |
| git_commit_id | 测试提交ID |
app.js所在目录保持一致$GIT_ROOT/iiidevops/postman/postman_collection.json(测试集合)$GIT_ROOT/iiidevops/postman/postman_environment.json(环境配置)test_origin的变量作为请求的基础地址,格式如{{test_origin}}/user/login,且不要在环境文件中定义test_origin执行报告以JSON字符串形式存储在数据库的report列中,包含两部分测试结果:
in_db:数据库中的测试结果json_file:仓库中Postman集合的测试结果json{ "in_db":{ "assertions":{ "total":0, "pending":0, "failed":0 }, "executions":[ ] }, "json_file":{ "assertions":{ "total":3, "pending":0, "failed":1 }, "executions":[ { "name":"login_AM", "method":"POST", "path":"user/login", "assertions":[ ] }, { "name":"Project list", "method":"GET", "path":"project/list", "assertions":[ { "assertion":"success test" }, { "assertion":"message test" }, { "assertion":"this should fail", "error_message":"expected 'success' to deeply equal 'failed'" } ] } ] } }
assertions:包含测试断言统计,包括总断言数、待处理断言数和失败断言数executions:包含每个测试用例的详细执行信息executions.assertions:每个断言的结果,仅当测试出错时包含error_message键,无该键表示断言成功您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务