Arquillian: Effective TestsFROM THE CLIENT TO THE SERVER                          Lukas Fryc
Testing       Testing       Testing       Testing     #Agile       Testing       Testing#TDD   Testing       Testing      ...
“But image testing oflarge enterpriseapplication.”     Enterprise Java Web Application
“In such case, its noteasy to define how thetests should look like.”                           Testing...
“How would you completeequation?What word do youimagine when someonesays testing?”                          Testing = ?
“My favorite is...”                      Testing = Pain
“Its even possible tochange equation andmake the testingenjoyable?”                   Testing = Enjoyable!
No one saves the World?
“There is one: he is braveand comes from far deepspace...”
“And brings heavy gearfor fighting with alienbugs...”
“...and he is proud toshare his powerful gearwith us!”
“At first, he comes with   Ability to split one big  deployment into manysmall, testing as little ascomponents as possible...
“And he makes surethese deployments work     on various of earth    application servers.”
“...and once he deploys        the deployment into container, he makes sureyou have all the goodness       from inside ava...
“...and thats all backedwith strong development                     tools.”
“That all, and you can run                   it just from your IDE, re-                    using what you already         ...
Testing Revolution
Ike brings tests to the Server
But what about the Client?
The little bit of Theory...
“Lets have ideal testingpyramid in mind,otherwise...”
Enough Theory!
Lets bring tests to the Client
“But it isnt as simple asin Java - many differentenvironments.”
“Fortunately there is toolwhich allows you to writetests in unified API for allthose browsers.”
“And the even supportsmocked browsers withsame API.”
Oh, such a great tool!
Lets invade client!
“Ouch, we need some        abstraction!”
“Even if we use favoriteprogrammatic approach,we can end up with manytests which takes days topass and quickly turnsout in...
At least, the app is covered...
“But this is what actuallySelenium see.”
Black Box
“Selenium is able to testtransitions betweenpages.”                      Page Transitions
“...and a portion of all thepage source code –JavaScript handlers,selected CSS and DOMchanges as reaction touser interacti...
Lets change the game...
Right tool for the Job
“Lets take the anoutstanding UIautomation tool...”
“And add your favoritelanguage.”
“And little bit of Alientechnology.”
“His name is Drone andhe is proud member ofArquillian crew!”                     Arquillian Drone
“He is basically ...”                        Hard-Worker
“Drone comes to bringthe browser to your test.”
Let Ike invade the Client
“But something else isneeded to make yourtests green.”
“Something enoughstrong to handle all theinconsistencies.”
“Lets deploy that to thebrowser page and seewhat happens!”
Strong type-safe API
Proven to handle AJAX
Invades the Client
Cross-Cutting Concerns
Arquillian Graphene
“We are still writing low-level interactioncommands, right?”               Isnt that too low-level?
“Lets look for somethingon higher level.”                Reusable Abstractions
“Introducing well-knownSelenium pattern:”                          Page Objects
“Lets imagine youhave page with all theelements and youexpress them asfields in the class.”
“You can even usefluent API for pagetransitions, sinceeach method canreturn next page asthe result.”
“But for modern AJAX-based application, itssimply not enough.”
“Lets think a littleabout that:In enterpriseapplications, yourather reuse UIcomponents.”
“What about creatingthe model of thesecomponents fromtheir users point ofview?”
Component Objects
Arquillian Graphene   Component Objects
Review what we have
“Now, we can simplywrite tests on properlevel of abstractionwith minimumefforts.”
3   Missing    Pieces
“What is missing here?” JUnitTestNG
How to avoid manual...?
“We can automatically                  snap screen-shots of the                          whole pages and                  ...
Automated Visual Verification
The Music of the Future?
“It is music of thefuture, but there isproject which alreadyfocuses efforts there.”                    Arquillian RushEye
“2 parts are missing now:         server is already covered          with unit and integration         tests, but what abo...
“Unit testing of clientis even moreimportant than unittesting of server,since it suffers fromenvironmentdiversity.”       ...
“But once those unittests are written, howto automate them?Without automation,they are not tests.”       Yet another tool ...
“Lets use theconfiguration what wehave for Drone – lethim instantiate abrowser, which willrun the unit tests.”        Reus...
“For writing actualtests, you can useyour favorite JS clienttesting tool.We are actuallyworking onintegration withQUnit.” ...
“And once the client is                  covered too, only         integration tests for client                      are m...
“The integrationtesting of client isactually making sureit communicates withserver as expected.”          Client / Server ...
Take client on the Tour to Server!
“We have browser and  test on one side andserver on opposite side.”
“With UI automation, weare sending request from  client to the server.”
“And server generates     response.”
Black Box!
“On the other hand, when  we are testing server  from its JVM, we are mocking requests, which   invokes verification      ...
Dont mock me!
“Lets make theconnection between client    and server live.”
“Once the requests goes to the server, the test code is serialized and   sent as part of the        request.”
“Server de-serializes thetesting code from requestand uses it for verification   of the server state inseveral lifecycle p...
“And then is the testing object sent back to theclient, which can validate            it.”
“Client can verify the response and send  another request.”
Crazy idea?
“But it already works!”                          JSFUnit
“Now, we are covered!” JUnitTestNG
Client Invasion
Its all?
It cant be without some buzz....
Lets go Mobile!
“Drone can actuallyreplace all the browsers.”
“And use Android driverfor connecting to mobile                device.”
“Additionally, Androidextension can start theemulator or connect to   real device, which is    perfect addition for runnin...
Arquillian Android
“Drone brings yourAndroid browser just into       your test.”
Arquillian
Experience the future now
But I must to know more...
http://bit.ly/arq-preview
http://bit.ly/arq-users
Join us...
http://github.com/arquillian
http://bit.ly/arq-devs
http://bit.ly/jboss-testing
#jbosstesting @ irc.freenode.net
#Arquillian
Enjoy the Testing!
@LFryc     Lukas Frychttp://bit.ly/lfryc
Photographs and pictures used in this   presentation are authored by various authors    and released under the Creative Co...
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the server
Arquillian: Effective tests from the client to the server
Upcoming SlideShare
Loading in...5
×

Arquillian: Effective tests from the client to the server

1,837

Published on

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?

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,837
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
35
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Arquillian: Effective tests from the client to the server

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

    Clipping is a handy way to collect important slides you want to go back to later.

×