Test depths within Java EE

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

TDD and BDD is a crucial discipline to write good and robust applications. Testing within the Java EE may cover several test depths. This post is only a short overview of possible involved products.

Testing - test depth Local Testing

  • In the local testing part or Java SE Testing, we test against a single class.
  • Therefore the test execution is fast.
  • Preferred tools are JUnit (or TestNG), Mocking frameworks like Mockito

Multi-Unit Testing

  • This test stage test against a service or a dedicated environment like CDI provider or JPA DB
  • For CDI tests: CDI-Unit, Apache DeltaSpike
  • Tests in CDI involves correct setup and wiring
  • For JPA tests: Testing against in-memory databases
  • Tests in JPA involves proper setup and logical queries correctness
  • since tests are executed against an environment, they need more time to be executed

Integration Testing

  • In this test stage, you may test the component, subsystem or the whole application
  • Arquilian allows in-container testing with JBoss and other Java EE vendors
  • Apache OpenEJB can be used to start test against the whole Java EE Stack
  • Since you are testing against a defined target environment, it takes more time to test.
Please remember the terms for blog comments.