Skip to Content
author's profile photo Former Member
Former Member

Executing all @UnitTests in testsrc/ and in web/testsrc in one ant run


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

Thanks for your help,


Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 20, 2014 at 12:53 PM

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

    If that doesn't work for you, then perhaps you will have to consider further customisation:

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

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

  • Posted on Dec 04, 2014 at 11:02 AM

    Have a look at this answer:

    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="" 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}" />
                 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="${}/TESTS-${testtarget}-${web}.xml" />
         <target name="run-continuously-tests">
             <antcall target="run-tests">
                 <param name="testtarget" value="unittests" />
                 <param name="web" value="false" />
             <antcall target="run-tests">
                 <param name="testtarget" value="unittests" />
                 <param name="web" value="true" />

    Of course you have to change the paths and parameters accordingly to your setup

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 20, 2014 at 04:03 PM

    There was a time (around 4.7), a

     yunitinit yunit yunitweb

    would do the job. Maybe it is still working.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.