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
57
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
51
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Become a Pro
speakerdeck
PRO
26
5k
Writing Fast Ruby
sferik
628
61k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Mobile First: as difficult as doing things right
swwweet
222
9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
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!