on 06-19-2014 5:02 PM
Hi,
I'm trying to execute all the @UnitTests in testsrc/ and web/testsrc/ of our extensions in one ant build on our CI server. If I execute
ant yunitinit unittests
only the tests in testsrc/ are executed. Calling
ant unittests -Dtestclasses.web=true
executes only the tests in web/testsrc/ but not the ones in testsrc/.
Any suggestions? Is it possible to execute all the tests at once? My hybris Platform version is 5.1.1.0.
Thanks for your help,
Olaf
Have a look at this answer: https://answers.sap.com/questions/12751500/executing-unit-tests-in-hybris-5.html?childToView=1277668...
Another solution is to create your own ant script having something like this:
<target name="run-tests">
<fail message="'testtarget' is a mandatory parameter!" unless="testtarget" />
<fail message="'web' is a mandatory parameter!" unless="web" />
<echo message="Starting '${testtarget}' for the following extensions: '${test.extension.names}'; web='${web}'." />
<property name="hybris.platform.basedir" location="./../../bin/platform/" />
<property name="hybris.ant.antfile" value="build.xml" />
<property name="testresult.output.file" location="${hybris.platform.basedir}/../../log/junit/TESTS-TestSuites.xml" />
<dirname property="testresult.output.directory" file="${testresult.output.file}"/>
<ant antfile="${hybris.ant.antfile}" dir="${hybris.platform.basedir}" target="${testtarget}">
<property name="testclasses.extensions" value="${test.extension.names}" />
<property name="testclasses.web" value="${web}" />
</ant>
<!--
Since we're calling hybris' internal yunit target twice the second call would overwrite the
results (${testresult.output.file}) from the first run. Thus we simply move the file from the
first run to make sure Jenkins can collect ALL results.
-->
<move file="${testresult.output.file}" tofile="${testresult.output.directory}/TESTS-${testtarget}-${web}.xml" />
</target>
<target name="run-continuously-tests">
<antcall target="run-tests">
<param name="testtarget" value="unittests" />
<param name="web" value="false" />
</antcall>
<antcall target="run-tests">
<param name="testtarget" value="unittests" />
<param name="web" value="true" />
</antcall>
</target>
Of course you have to change the paths and parameters accordingly to your setup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There was a time (around 4.7), a
yunitinit yunit yunitweb
would do the job. Maybe it is still working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perhaps you could make your own ant target? Just place this code in one of the buildcallbacks.xml files (possibly in your *core extension). Try this:
<target name="citests" description="executes all required tests for the CI Pipeline">
<callback extname="" target="before_citests"/>
<annotationtests annotations="integrationtests,unittests"/>
<annotationtests annotations="unittests" web="true"/>
<callback extname="" target="after_citests"/>
</target>
If that doesn't work for you, then perhaps you will have to consider further customisation: https://wiki.hybris.com/display/release5/Customizing+Tests+Execution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Scott,
thank you for your help! Unfortunately the parameter "web" is mapped to an (unmodifiable) property in the annotationtests macro and thus the second call executes the non-web tests, too.
I tried wrapping it in an antcall that executed both tests but the web test result overwrote the non-web test result 😞
So I'll try the Customization...
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.