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
49
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
640
Testing-Darwinismus
qabbasi
0
44
Featured
See All Featured
Docker and Python
trallard
33
2.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
319
23k
Teambox: Starting and Learning
jrom
126
8.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
219
21k
Infographics Made Easy
chrislema
237
18k
Bash Introduction
62gerente
604
210k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
14
1.3k
Product Roadmaps are Hard
iamctodd
43
9.6k
Producing Creativity
orderedlist
PRO
335
39k
10 Git Anti Patterns You Should be Aware of
lemiorhan
644
57k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
272
12k
Fontdeck: Realign not Redesign
paulrobertlloyd
75
4.8k
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!