CDI-Unit is a JUnit4 test runner that enables unit testing Java CDI applications.


  • Fast¬†– CDI-Unit only starts up the bare minimum when running your unit tests. Got a large project with thousands of classes on the classpath? No problem.
  • Easy – All configuration is performed in the unit test class using annotations. No external files, no XML.
  • Contained – Your tests¬†are run outside of a web container. No risk of resource conflicts or environment specific behaviour.

Get CDI-Unit

CDI-Unit is distributed through maven, so you just need to add the dependency to your pom:


Note that CDI-Unit is now distributed through maven central. Users of older versions should upgrade and remove references to the old repository from their poms.

Weld compatibility

CDI-Unit is compatible with Weld 1.1.4 and above.

Post to Twitter