一个无需外部依赖即可运行Behat的独立Docker镜像。该镜像属于Docksal项目的一部分。
将此镜像当作二进制文件使用。工作目录需挂载到容器内的/src目录。
bash$ docker run --rm -v $(pwd):/src docksal/behat --version behat version 3.1.0
为方便使用,可在.bashrc、.zshrc等文件中添加shell别名:
bashalias behat='docker run --rm -v $(pwd):/src docksal/behat --colors "$@"'
重启shell或打开新shell后即可直接使用:
bash$ behat --version behat version 3.1.0
示例设置和测试可在example文件夹中找到。包含以下特性:
bashgit clone https://github.com/docksal/behat.git docksal-behat cd docksal-behat/example ./run-behat features/blackbox.feature
若要运行需要真实浏览器的Behat测试(如JavaScript支持),可使用无头Selenium Chrome/Firefox。示例文件夹中提供了Docker Compose配置,可快速搭建Selenium Chrome环境:
bashcd example docker-compose up -d ./run-behat features/blackbox-javascript.feature
在docker-compose.yml中取消相应行的注释:
yaml# 选择/取消注释其中一项 image: selenium/standalone-chrome #image: selenium/standalone-firefox
更新容器配置:
bashdocker-compose up -d
根据需要更新behat.yml:
Chrome配置:
yamlbrowser_name: chrome selenium2: wd_host: http://browser:4444/wd/hub capabilities: { "browser": "chrome", "version": "*" }
Firefox配置:
yamlbrowser_name: firefox selenium2: wd_host: http://browser:4444/wd/hub capabilities: { "browser": "firefox", "version": "*" }
运行测试
HTML报告会生成到html_report文件夹中。可通过浏览器访问http://<你的Docker主机IP>:8000/html_report查看(将<你的Docker主机IP>替换为实际IP,如localhost)。
使用以下命令可在容器中启动bash会话:
bashdocker run --rm -v $(pwd):/src -it --entrypoint=bash docksal/behat
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务