我想知道是否有一种方法可以为不同的功能使用不同的上下文类.
我想有一个功能使用MinkExtensions进行浏览器测试,另一个使用和客户端一样使用Guzzle进行API测试 - 两者都有不同实现的类似步骤.
应该可以在Behat 3.中查看http://everzet.com/tagged/Behat 功能:"多上下文运行,支持每个标记,每个目录和每个角色的上下文类.这个"角色的重要性"口头禅我总是在讲道,最终成为可能,因为每个角色最终都能拥有自己的步骤字典."
目前,在Behat 2中,您可以使用不同的配置文件来分隔功能.在你的behat.yml中,你可以有这样的东西:
#running login suite using Mink
login-suite:
paths:
features: features/login-suite
bootstrap: features/login-suite/bootstrap
extensions:
mink-extension.phar:
base_url: http://domain.org
formatter:
name: pretty, junit, html
parameters:
output_path: null, logs/login-suite/, logs/login-suite/out.html
#running logout suite using the WebApi
logout-suite:
paths:
features: features/logout-suite/
bootstrap: features/logout-suite/bootstrap/
formatter:
name: pretty, junit, html
parameters:
output_path: null, logs/login-suite/, logs/logout-suite/out.html
extensions:
Behat\WebApiExtension\Extension:
base_url: http://api.domain.org
Run Code Online (Sandbox Code Playgroud)
Login-suite和logout-suite功能的FeatureContext.php文件现在已分开.
问题是现在你无法一次运行所有测试.可以使用上下文来实现:http: //docs.behat.org/guides/7.config.html#Context
| 归档时间: |
|
| 查看次数: |
3306 次 |
| 最近记录: |