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
58
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
730
Testing-Darwinismus
qabbasi
0
55
Featured
See All Featured
Thoughts on Productivity
jonyablonski
68
4.4k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Building Applications with DynamoDB
mza
93
6.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
520
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Optimising Largest Contentful Paint
csswizardry
33
3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Docker and Python
trallard
43
3.2k
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!