Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Java User Group Frankfurt – CDI BeanTesting
Search
Qaiser Abbasi
July 02, 2016
0
56
Java User Group Frankfurt – CDI BeanTesting
Qaiser Abbasi
July 02, 2016
Tweet
Share
More Decks by Qaiser Abbasi
See All by Qaiser Abbasi
How to reindex 1B documents in 1 hour?
qabbasi
0
720
Testing-Darwinismus
qabbasi
0
48
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Faster Mobile Websites
deanohume
305
30k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Gamification - CAS2011
davidbonilla
80
5k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Side Projects
sachag
452
42k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Being A Developer After 40
akosma
86
590k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Transcript
BEAN TESTING
BECAUSE LIFE IS TOO SHORT FOR INTEGRATION TESTS
Florian Fladung florian.fl
[email protected]
Qaiser Abbasi
[email protected]
Wofür Wie Was kann ich es verwenden? funktioniert Bean-Testing? ist
Bean-Testing?
Unit Tests Functional Tests Integration Tests
Unit Tests Functional Tests Integration Tests
U n it T e s t s Integration Tests
CDT Customer Driven Tests
UNIT TESTS Schnell Code Einheiten Mock
INTEGRATION TESTS
Application App Server Int-Tests
• Arquillian • Deployment needed • Java EE embedded •
Configuration hell
There are only 10 types of Testing: Unit Tests Integration
Tests
JPA Queries Persistence Services CDI Components Integration Test ?? Bean
Validation Constraints Distributed Business Logic
Unit Test Integrationstest
None
BEAN TESTING
Unit Tests BeanTests Integration Tests milliseconds seconds (several) minutes FEEDBACK
None
̣ Since Java EE 6 (2009) ̣ Origin JBoss Seam
(Gavin King) ̣ You can inject everything
None
Dependency Injection Producer Methods Interceptors Decorators CDI Events CDI Extensions
EJB Transactional Security Pooled Remote Interceptors Interceptors Scoped ?
CDI Extensions @Stateless public class MyService{} @RequestScoped @Transactional public class
MyService{} @EJB private MyService myService; @Inject private MyService myService;
https://github.com/NovaTecConsulting/BeanTest
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
Wo kann ich Bean-Test einsetzen? 6 5 Dependency Injection 7
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)
Was kann ich mit Bean-Test testen? BPM Engine Integration (Camunda,
Activiti) JSF Backing Beans 3rd Party Libraries Integration
Persistence Services Business Functions Services (Façade)
Persistence Services Business Functions Services (Façade) Backing Beans (JSF)
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
JavaEE 8 ? https://java.net/jira/browse/JAVAEE_SPEC-35
Danke!