How to run only one unit test using ant

Hybris 6 - Since Hybris 4.4

Suppose you want to run the tests in the package de.coreservices.strategies.impl. Then your tests must have one of the annotations @UnitTest, @IntegrationTest, @DemoTest, @PerformanceTest or @ManualTest and you can type:

ant all alltests -Dtestclasses.packages=de.coreservices.strategies.impl.*

This will run tests in the folder testsrc of your extension. If you want to run the tests of the folder web/testsrc, you must use:

ant all allwebtests -Dtestclasses.packages=de.coreservices.web.converters.impl.*

All test in an extension

ant unittests -Dtestclasses.extensions=myext

Before SAP Hybris 5.3

This way of starting the tests ist deprecated and in Hybris 5.3 the ant target was removed. Please read:
Testing in the hybris Multichannel Suite

ant clean all yunit

With the parameter test you can choose a test to run. Unfortunately you cannot run two or more tests.

–Based on SAP Hybris 6.4, 5.7, 4.8.14


Bogdan I., 2019/09/10 13:38

ant unittests -Dtestclasses.extensions=myext

Antonio Robirosa, 2020/06/30 15:30

Thanks Bogdan!

Enter your comment. Wiki syntax is allowed: