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
62
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
750
Testing-Darwinismus
qabbasi
0
58
Featured
See All Featured
A Tale of Four Properties
chriscoyier
159
23k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Statistics for Hackers
jakevdp
799
220k
Producing Creativity
orderedlist
PRO
346
40k
Site-Speed That Sticks
csswizardry
10
630
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
16
920
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
123
52k
Into the Great Unknown - MozCon
thekraken
39
1.8k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
690
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!