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 clean 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 clean all allwebtests -Dtestclasses.packages=de.coreservices.web.converters.impl.*

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 -Dtest=de.sample.coreservices.services.impl.PriceRowBasedEnergyPriceServiceTest

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

Discussion

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

ant unittests -Dtestclasses.extensions=myext

Enter your comment. Wiki syntax is allowed: