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 &"