Q: How to run unit tests only for a class in a Hybris project through Command line? Many times due to some errors in project or mis-configuration in eclipse, Junits fails to run for a class. How one can execute such unittests from command line without wasting effort.

A: Many times due to some errors in project or mis-configuration in eclipse, Junits fails to run for a class. While working in a hybris project, we have an option to execute our junits from command line as well.

*

*Go to platform directory.


*Set ant environment.


*Execute test with below script:
ant unittests -Dtestclasses.suppress.junit.tenant=true -Dtest="**fully-qualified test class name**"

or
ant unittests -Dtestclasses.suppress.junit.tenant=true -Dtest="de.hybris.platform.acceleratorfacades.cart.action.populator.AcceleratorCartEntryActionPopulatorTest"



*Then one can check report generated at below directory.
Report dir : D:\HybrisSetup\Code\hybris\log/junit

