5

I configured the Magento Test Automation Framework (MTAF) with Jenkins and Sauce Labs and everything is working well. However, when building a multi-configuration project, I have selected two more browsers from the browser list in Jenkins' job configuration for parallel execution.

When doing the build it is taking the browser from the MTAF configuration file (browser.yaml) instead of selecting the browser from Jenkins' job configuration.

Is there any way to execute the browsers from Jenkins, not from MTAF's config file?

Johan Dahlin
  • 21,541
  • 5
  • 35
  • 52

1 Answers1

0

MTAF has runtests.sh script which allow to do that. You can pass parameters to the script in case you would like to run several configurations or browsers at the same time. For passing parameters use next template:

runtests.sh application:browser, application:browser

Where application is name of link to default application (by default: *mage).

You need command like this:

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

And use it as value in phpunit in Jenkins configuration. Now you have something like this:

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

Change to command provided above and it should do the trick. And last, if you want to keep all this phpunit arguments, open file runtests.sh, find function runTest() and change line

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

to line with your phpunit arguments:

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 &"
ToxaBes
  • 1,579
  • 8
  • 17