on 11-26-2014 2:29 PM
Hello,
We are having a set of unit tests annotated with @UnitTest throughout a number of custom extensions. We want to integrate those tests with our continuous integration builds.
My understanding is that the ant unittests
target is what we need to use. The problem is that the ant unittests
target actually tries to fire up the whole server using the junit tenant. This is kind of confusing since we are trying to run unit tests (which mock all of their dependencies) and not integration tests so I cannot understand why the ant unittests
target tries to fire up the server. My understanding is that the target should really scan all extensions for unit tests annotated with the @UnitTest annotation, construct the correct classpath and execute the tests.
Can you please provide a guidance on how to execute our set of unit tests?
Best regards, Martin
We use the following ant script to execute the unit tests within the CI server: unittests.zip
You have to configure/change the following parts:
Property platformhome
: Should be the path to the hybris platform directory
Property test.extensions
: A list of extension names which should be tested, e.g. "customcore,customweb,custombackoffice" will test all unittests of customcore, customweb and custombackoffice
Property custom.extensions.directory
: The directory name in which your custom extensions are located, e.g. "custom" if your extension are located within hybris/bin/custom//
update: Uploaded ZIP-File again
update: Uploaded ZIP-File which works for Hybris 6.5: unittests-65.zip
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Since 6.4 you can use
ant unittests -Dtestclasses.suppress.junit.tenant=true .....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does anybody know whether this solution works for Hyris version 6?
I tried running this for Hybris Version 6 and am getting NoClassDefFoundError error. Has anyone else faced the same issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Enhanced testing.xml
works with hybris-5.4
restricted to unittests in custom extensions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We successfully use "ant unittest". Wasn't an easy one, to get this started.
One key advance was to limit the annotation scanner to our own packages with -Dtestclasses.packages=....
The second learning was that some code needed refactoring, because typically Config.get... or misc. Util.classes fire up a server. It's indeed not easy to figure out where this comes from.
At least you can find out which unit test launches the tenant, then run it in your IDE with debugging and pause the thread once you see tenant araising.
Good luck!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We created our own ant script which executes the JUnit-Tests without running the hybris server.
We did this because the hybris way using ant unittests
takes 25 minutes to execute all unit tests. Our own script takes about 3 minutes to execute exactly the same unit tests with the same result.
Starting the hybris server brings you even more problems, not only the extensive runtime. If you need to have the AspectJ weaving enabled for your system to start, you are executing the unit tests on classes which have been weaved. That's usually not what somebody wants to have because with that you are testing more than just he class/method.
It would be cool if Hybris solves the mentioned JIRA Ticket! If somebody is interested in our script, just give me a short hint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, from what I see the ticket is in a JIRA that is no longer supported.
Can we have an official statement for this question by Hybris as based on the watch list quite a few people are interested into it.
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 JIRA-ticket which exactly describes this problem.
I'm also interested in getting the hybris4 behavior back!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
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.