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 SE 1.0.1 users

If you are using Weld SE as a compile time dependency then you must specify version 1.1.0 or above as CDI-unit is not compatible with Weld SE 1.0.1

Post to Twitter

One thought on “CDI-Unit

  1. Pingback: Using CDI standalone | Coders Kitchen