我正在尝试通过grunt运行cucumberjs测试,以获得一系列浏览器堆栈功能。
矩阵正常配置为" grunt“(qcuberbatch为本地grunt任务定义):
grunt.initConfig
qcumberbatch:
options:
steps: 'src/features/integration/steps'
tags: '~@ShouldFail'
browserstack:
'browserstack.user' : process.env.BS_USER
'browserstack.key' : process.env.BS_ACCESS_KEY
'browserstack.tunnel' : 'true' # This was the secret!
matrix: [
browser: 'firefox'
browser_version: '26.0'
os: 'Windows'
os_version : '7',
,
browser : 'IE',
browser_version : '9.0',
os : 'Windows',
os_version : '7',
resolution : '1024x768'
]
hub: "http://hub.browserstack.com/wd/hub"
local:
files:
src: ['src/features/integration/*']
options:
hub: 'http://localhost:4444/wd/hub'
matrix: ['firefox']
browserstack:
files:
src: ['src/features/integration/*']
failing:
files:
src: ['src/features/integration/*']
options:
tags: '@ShouldFail'默认选项是在Windows7上使用firefox和IE在browserstack上运行,本地测试覆盖browserstack以使用本地selenium webdriver集线器。
cucumber世界是用一个接受capabilities对象的构造函数来设置的:
module.exports = class World
###
Create a new world, assuming firefox capabilities.
@param {string} browser property name from the `webdriver.Capabilities`
list.
###
constructor: (capabilities = {browserName: "firefox"})->
@driver = new webdriver.Builder().
usingServer(process.env.SELENIUM_HUB).
withCapabilities(capabilities).build()
@driver.manage().timeouts().setScriptTimeout(10000)在grunt中运行这个程序时,问题是cucumberjs没有编程接口(我看出来了)。如果不能配置在运行时加载几个功能块中的哪一个,我应该如何在cucumberjs run和grunt之间传递这些功能?
发布于 2014-01-16 22:26:02
我会按照我的建议使用您的解决方案和一个JSON对象。
但是,如果您对更具编程性的方法感兴趣,您可以很容易地实例化Cucumber运行时。CLI源代码非常简单,它是如何从代码调用Cucumber的一个很好的例子。参见https://github.com/cucumber/cucumber-js/blob/master/lib/cucumber/cli.js。
发布于 2014-01-16 22:10:38
可能的解决方案:
使用所有功能的blob将文件写入grunt文件中的已知位置。然后,启动几个cucumberjs运行,使用一个进程环境变量告诉世界使用blob中的哪个功能。
我不喜欢这样,因为它涉及到每次运行创建临时文件,等等。我更喜欢在配置World对象时找到一种以编程方式使用cucumberjs的方法。
https://stackoverflow.com/questions/21164044
复制相似问题