JavaCro'14 - Taking testing to its limits – Aleš Justin
-
Upload
hujak-hrvatska-udruga-java-korisnika-croatian-java-user-association -
Category
Technology
-
view
902 -
download
0
description
Transcript of JavaCro'14 - Taking testing to its limits – Aleš Justin
![Page 1: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/1.jpg)
Taking testing to its limits
Aleš Justin, Red Hat
http://javacro.org/http://javacro.org/
![Page 2: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/2.jpg)
Agenda
• Testing?
• GAE TCK
• JUnit, ShrinkWrap, Arquillian
• Code coverage, reports, CI, …
![Page 3: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/3.jpg)
Testing?
• Do you test?
• Never enough time
• Hard to test
• “If there is no test, it doesn’t work”
• ~50% test code
• New frameworks to actually test
![Page 4: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/4.jpg)
GAE TCK
• GAE?
• Google App Engine
• JBoss CapeDwarf
• Open source GAE API impl
• Does it work?
• Voila TCK - www.appengine-tck.org
![Page 5: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/5.jpg)
JUnit
• Simple as @Test
• Together with Maven Surefire plugin
• Extendable
• @RunWith
• Assert, Assume, @Ignore, …
![Page 6: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/6.jpg)
ShrinkWrap
• Binaries abstraction
• No more Ant or Maven assemblies
• Nice and simple, yet powerful API to create *programmatic* deployments
![Page 7: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/7.jpg)
Arquillian
• Environment / runtime abstraction
• Proper and easy in-container testing
• “Container” imp
• A ton of existing container impls
• Invocation protocol
• Servlet, JMX, @RunAsClient, etc
![Page 8: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/8.jpg)
Arquillian
• Transparent container usage
• Exactly one container impl on classpath
• JUnit, TestNG support
• Extendable
• Drone, Graphene, etc
![Page 9: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/9.jpg)
TCK Features
• NOTE — It’s all *generic*
• Not tied to GAE API or TCK
• TODO of moving this into separate project
![Page 10: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/10.jpg)
Code coverage
• Display API usage
• Bytecode check
• Fast
• No runtime involved
• Link against source code
• JSP check
![Page 11: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/11.jpg)
Reports
• Graphical results presentation
• Pie and XY chart
• Drill-down for more info
• Pushed from TeamCity CI
• Custom push TeamCity plugin
• Endpoints stubs
![Page 12: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/12.jpg)
Utils
• Multisuite
• One big deployment
• Environment info and extension
• “Events”
• @WithinNamespace, @UserIsLoggedIn
• Transformers
• Turn plain JUnit test into ARQ test
![Page 13: JavaCro'14 - Taking testing to its limits – Aleš Justin](https://reader036.fdocuments.net/reader036/viewer/2022081907/5478e88db4af9fb9158b46f5/html5/thumbnails/13.jpg)
Q&A
• [email protected] / @alesj
• www.capedwarf.org
• www.appengine-tck.org
• https://github.com/GoogleCloudPlatform/appengine-tck