Arquillian: Effective tests from the client to the server
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Arquillian: Effective tests from the client to the server



Tools like Selenium, an outstanding tool for UI test automation, and Arquillian, an award-winning integration testing framework, offer a base for high-quality tests which are crucial for a web app ...

Tools like Selenium, an outstanding tool for UI test automation, and Arquillian, an award-winning integration testing framework, offer a base for high-quality tests which are crucial for a web app development. However writing UI tests and covering server-side logic leaves many questions open:

* Does Selenium cover everything? Page transitions, simple JavaScript interaction and a portion of DOM. Is it really enough?
* Mocking requests for testing server-side code is pain. Is it necessary?
* Are you able to detect that your component’s visual representation changes?
* Does investigating these changes involve a disproportionate amount of effort?
* Isn’t manual test development too expensive?



Total Views
Views on SlideShare
Embed Views



1 Embed 97 97



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Arquillian: Effective tests from the client to the server Presentation Transcript

  • 1. Arquillian: Effective TestsFROM THE CLIENT TO THE SERVER Lukas Fryc
  • 2. Testing Testing Testing Testing #Agile Testing Testing#TDD Testing Testing Testing Testing “You can hear about testing Testing from everywhere!”
  • 3. “But image testing oflarge enterpriseapplication.” Enterprise Java Web Application
  • 4. “In such case, its noteasy to define how thetests should look like.” Testing...
  • 5. “How would you completeequation?What word do youimagine when someonesays testing?” Testing = ?
  • 6. “My favorite is...” Testing = Pain
  • 7. “Its even possible tochange equation andmake the testingenjoyable?” Testing = Enjoyable!
  • 8. No one saves the World?
  • 9. “There is one: he is braveand comes from far deepspace...”
  • 10. “And brings heavy gearfor fighting with alienbugs...”
  • 11. “...and he is proud toshare his powerful gearwith us!”
  • 12. “At first, he comes with Ability to split one big deployment into manysmall, testing as little ascomponents as possible in separation.”
  • 13. “And he makes surethese deployments work on various of earth application servers.”
  • 14. “...and once he deploys the deployment into container, he makes sureyou have all the goodness from inside available using dependency injection.”
  • 15. “...and thats all backedwith strong development tools.”
  • 16. “That all, and you can run it just from your IDE, re- using what you already now.”JUnit TestNG
  • 17. Testing Revolution
  • 18. Ike brings tests to the Server
  • 19. But what about the Client?
  • 20. The little bit of Theory...
  • 21. “Lets have ideal testingpyramid in mind,otherwise...”
  • 22. Enough Theory!
  • 23. Lets bring tests to the Client
  • 24. “But it isnt as simple asin Java - many differentenvironments.”
  • 25. “Fortunately there is toolwhich allows you to writetests in unified API for allthose browsers.”
  • 26. “And the even supportsmocked browsers withsame API.”
  • 27. Oh, such a great tool!
  • 28. Lets invade client!
  • 29. “Ouch, we need some abstraction!”
  • 30. “Even if we use favoriteprogrammatic approach,we can end up with manytests which takes days topass and quickly turnsout into maintananceburden!” Java C# Python Ruby PHP Perl
  • 31. At least, the app is covered...
  • 32. “But this is what actuallySelenium see.”
  • 33. Black Box
  • 34. “Selenium is able to testtransitions betweenpages.” Page Transitions
  • 35. “...and a portion of all thepage source code –JavaScript handlers,selected CSS and DOMchanges as reaction touser interaction.” A little bit of... DOM / JavaScript / CSS
  • 36. Lets change the game...
  • 37. Right tool for the Job
  • 38. “Lets take the anoutstanding UIautomation tool...”
  • 39. “And add your favoritelanguage.”
  • 40. “And little bit of Alientechnology.”
  • 41. “His name is Drone andhe is proud member ofArquillian crew!” Arquillian Drone
  • 42. “He is basically ...” Hard-Worker
  • 43. “Drone comes to bringthe browser to your test.”
  • 44. Let Ike invade the Client
  • 45. “But something else isneeded to make yourtests green.”
  • 46. “Something enoughstrong to handle all theinconsistencies.”
  • 47. “Lets deploy that to thebrowser page and seewhat happens!”
  • 48. Strong type-safe API
  • 49. Proven to handle AJAX
  • 50. Invades the Client
  • 51. Cross-Cutting Concerns
  • 52. Arquillian Graphene
  • 53. “We are still writing low-level interactioncommands, right?” Isnt that too low-level?
  • 54. “Lets look for somethingon higher level.” Reusable Abstractions
  • 55. “Introducing well-knownSelenium pattern:” Page Objects
  • 56. “Lets imagine youhave page with all theelements and youexpress them asfields in the class.”
  • 57. “You can even usefluent API for pagetransitions, sinceeach method canreturn next page asthe result.”
  • 58. “But for modern AJAX-based application, itssimply not enough.”
  • 59. “Lets think a littleabout that:In enterpriseapplications, yourather reuse UIcomponents.”
  • 60. “What about creatingthe model of thesecomponents fromtheir users point ofview?”
  • 61. Component Objects
  • 62. Arquillian Graphene Component Objects
  • 63. Review what we have
  • 64. “Now, we can simplywrite tests on properlevel of abstractionwith minimumefforts.”
  • 65. 3 Missing Pieces
  • 66. “What is missing here?” JUnitTestNG
  • 67. How to avoid manual...?
  • 68. “We can automatically snap screen-shots of the whole pages and compare them with historical data – its proven that rendering on one particular browser and platform, images will be binary same.”Screen-shot Comparison
  • 69. Automated Visual Verification
  • 70. The Music of the Future?
  • 71. “It is music of thefuture, but there isproject which alreadyfocuses efforts there.” Arquillian RushEye
  • 72. “2 parts are missing now: server is already covered with unit and integration tests, but what about the same tests for client?” JUnitTestNG
  • 73. “Unit testing of clientis even moreimportant than unittesting of server,since it suffers fromenvironmentdiversity.” Unit Testing Client
  • 74. “But once those unittests are written, howto automate them?Without automation,they are not tests.” Yet another tool to configure?
  • 75. “Lets use theconfiguration what wehave for Drone – lethim instantiate abrowser, which willrun the unit tests.” Reuse the Automation Setup
  • 76. “For writing actualtests, you can useyour favorite JS clienttesting tool.We are actuallyworking onintegration withQUnit.” QUnit
  • 77. “And once the client is covered too, only integration tests for client are missing.” JUnitTestNG
  • 78. “The integrationtesting of client isactually making sureit communicates withserver as expected.” Client / Server Round-Trip
  • 79. Take client on the Tour to Server!
  • 80. “We have browser and test on one side andserver on opposite side.”
  • 81. “With UI automation, weare sending request from client to the server.”
  • 82. “And server generates response.”
  • 83. Black Box!
  • 84. “On the other hand, when we are testing server from its JVM, we are mocking requests, which invokes verification code.”
  • 85. Dont mock me!
  • 86. “Lets make theconnection between client and server live.”
  • 87. “Once the requests goes to the server, the test code is serialized and sent as part of the request.”
  • 88. “Server de-serializes thetesting code from requestand uses it for verification of the server state inseveral lifecycle phases.”
  • 89. “And then is the testing object sent back to theclient, which can validate it.”
  • 90. “Client can verify the response and send another request.”
  • 91. Crazy idea?
  • 92. “But it already works!” JSFUnit
  • 93. “Now, we are covered!” JUnitTestNG
  • 94. Client Invasion
  • 95. Its all?
  • 96. It cant be without some buzz....
  • 97. Lets go Mobile!
  • 98. “Drone can actuallyreplace all the browsers.”
  • 99. “And use Android driverfor connecting to mobile device.”
  • 100. “Additionally, Androidextension can start theemulator or connect to real device, which is perfect addition for running in continuous integration systems.”
  • 101. Arquillian Android
  • 102. “Drone brings yourAndroid browser just into your test.”
  • 103. Arquillian
  • 104. Experience the future now
  • 105. But I must to know more...
  • 106.
  • 107.
  • 108. Join us...
  • 109.
  • 110.
  • 111.
  • 112. #jbosstesting @
  • 113. #Arquillian
  • 114. Enjoy the Testing!
  • 115. @LFryc Lukas Fryc
  • 116. Photographs and pictures used in this presentation are authored by various authors and released under the Creative Commons license