Jenkins使用MTAF构建多配置项目,而不是在Sauce Labs上工作

时间:2013-05-09 10:11:16

标签: magento jenkins saucelabs mtaf multi-configuration

我使用Jenkins和Sauce Labs配置了Magento测试自动化框架(MTAF),一切运行良好。但是,在构建多配置项目时,我从Jenkins的作业配置中的浏览器列表中选择了另外两个浏览器来进行并行执行。

在进行构建时,它将从MTAF配置文件(browser.yaml)中取出浏览器,而不是从Jenkins的作业配置中选择浏览器。

有没有办法从Jenkins执行浏览器,而不是从MTAF的配置文件执行?

1 个答案:

答案 0 :(得分:0)

MTAF有runtests.sh脚本允许这样做。如果您想同时运行多个配置或浏览器,可以将参数传递给脚本。对于传递参数,请使用下一个模板:

runtests.sh application:browser, application:browser

其中application是默认应用程序的链接名称(默认情况下:* mage)。

你需要这样的命令:

/path/to/script/runtests.sh mage:googlechrome, mage:firefox

并在Jenkins配置中将其用作phpunit中的值。现在你有这样的事情:

<target name="phpunit" description="Run unit tests with PHPUnit">
         <exec command="phpunit --configuration=${basedir}/tests/phpunit.xml
        --log-junit ${basedir}/build/logs/junit.xml
        --coverage-clover ${basedir}/build/logs/clover.xml
        --coverage-html ${basedir}/build/coverage"/>
</target>

更改为上面提供的命令,它应该可以解决问题。 最后,如果你想保留所有这些phpunit参数,打开文件runtests.sh,找到函数runTest()并更改行

eval exec "/usr/bin/phpunit -c ${phpunitArr[${i}]}/phpunit.xml &"

与你的phpunit参数对齐:

eval exec "/usr/bin/phpunit -c ${phpunitArr[${i}]}/phpunit.xml --log-junit /path/to/build/logs/junit.xml --coverage-clover /path/to/build/logs/clover.xml &"