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.
- 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
- 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
- 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.