apache deltaspike v0.6+ provides an easy to use, but quite powerful junit test-runner.
it's based on the container-control api of deltaspike. deltaspike itself currently provides implementations for openwebeans, weld and openejb (tomee).
the last one is important, if you need to test a cdi+ejb based application.
just by using a different container-control implementation (deltaspike-cdictrl-openejb) in your build config and adding openejb (/tomee) via org.apache.openejb:openejb-core, you can test cdi-beans as well as ejbs. just inject them as usual via @Inject (also @EJB works as expected).
an example can be found here.
Showing posts with label junit4. Show all posts
Showing posts with label junit4. Show all posts
Friday, April 18, 2014
Monday, December 2, 2013
[add-on] cdi tests with deltaspike 0.5
arquillian is nice, however, several projects don't need/use it.
several of them implemented a custom approach to control the cdi-container, start/stop scopes and check invalid state (esp. after a failed test). usually the basic tasks are the same or very similar. therefore i prototyped a deltaspike test-ctrl add-on based on some use-cases:
Update:
This add-on is part of all versions of DeltaSpike after v0.5
Labels:
cdi,
deltaspike,
deltaspike-add-on,
jsr 299,
junit4,
unit-test
Subscribe to:
Posts (Atom)