Java User Group Frankfurt – CDI BeanTesting

Efa70d43d8e57623d0d5fafaeef1109f?s=47 Qaiser Abbasi
July 02, 2016
26

Java User Group Frankfurt – CDI BeanTesting

Efa70d43d8e57623d0d5fafaeef1109f?s=128

Qaiser Abbasi

July 02, 2016
Tweet

Transcript

  1. BEAN TESTING

  2. BECAUSE LIFE IS TOO SHORT FOR INTEGRATION TESTS

  3. Florian Fladung florian.fladung@novatec-gmbh.de Qaiser Abbasi qaiser.abbasi@novatec-gmbh.de

  4. Wofür Wie Was kann ich es verwenden? funktioniert Bean-Testing? ist

    Bean-Testing?
  5. Unit Tests Functional Tests Integration Tests

  6. Unit Tests Functional Tests Integration Tests

  7. U n it T e s t s Integration Tests

  8. CDT Customer Driven Tests

  9. UNIT TESTS Schnell Code Einheiten Mock

  10. INTEGRATION TESTS

  11. Application App Server Int-Tests

  12. • Arquillian • Deployment needed • Java EE embedded •

    Configuration hell
  13. There are only 10 types of Testing: Unit Tests Integration

    Tests
  14. JPA Queries Persistence Services CDI Components Integration Test ?? Bean

    Validation Constraints Distributed Business Logic
  15. Unit Test Integrationstest

  16. None
  17. BEAN TESTING

  18. Unit Tests BeanTests Integration Tests milliseconds seconds (several) minutes FEEDBACK

  19. None
  20. ̣ Since Java EE 6 (2009) ̣ Origin JBoss Seam

    (Gavin King) ̣ You can inject everything
  21. None
  22. Dependency Injection Producer Methods Interceptors Decorators CDI Events CDI Extensions

  23. EJB Transactional Security Pooled Remote Interceptors Interceptors Scoped ?

  24. CDI Extensions @Stateless public class MyService{} @RequestScoped @Transactional public class

    MyService{} @EJB private MyService myService; @Inject private MyService myService;
  25. https://github.com/NovaTecConsulting/BeanTest

  26. Wie kann ich Bean-Test in meinem Projekt einsetzen ? <repository>

    <id>Novatec</id> <name>Novatec Repository</name> <url>http://repository.novatec-gmbh.de/content/repositories/novatec</url> </repository> <dependency> <groupId>info.novatec</groupId> <artifactId>bean-test</artifactId> <version>0.1</version> <scope>test</scope> </dependency> Persistence-Unit “beanTestPU” in src/test/resources/META-INF 1 2 3 Empty beans.xml in src/test/resources/META-INF
  27. Wo kann ich Bean-Test einsetzen? 6 5 Dependency Injection 7

  28. Was kann ich mit Bean-Test testen? Was ist verfügbar? Was

    kann man testen? Dependency Injection Dependencies (@EJB) JPA Runtime Queries, Beziehungen, Constraints Interceptors & Decorators Security CDI Events, CDI Producers CDI Events, CDI Producers (@Resource, @PersistenceContext)
  29. Was kann ich mit Bean-Test testen? BPM Engine Integration (Camunda,

    Activiti) JSF Backing Beans 3rd Party Libraries Integration
  30. Persistence Services Business Functions Services (Façade)

  31. Persistence Services Business Functions Services (Façade) Backing Beans (JSF)

  32. BEAN TESTING Hohe Geschwindigkeit (Feedback) mit großem Umfang DRY –

    Alles ist schon da (JPA, EJB, CDI, Interceptors, TestNG) nichtinvasive TDD ist möglich Verbesserte Qualität Zeit und Geld (und Nerven) sparen. Unabhängig von Application Server
  33. JavaEE 8 ? https://java.net/jira/browse/JAVAEE_SPEC-35

  34. Danke!