Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to selenium_grid_workshop

4,231 views

Published on

Published in: Technology
  • Check the source ⇒ www.HelpWriting.net ⇐ This site is really helped me out gave me relief from headaches. Good luck!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • My brother found Custom Writing Service ⇒ www.WritePaper.info ⇐ and ordered a couple of works. Their customer service is outstanding, never left a query unanswered.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Introduction to selenium_grid_workshop

  1. 1. Introduction toSelenium Grid Kevin Menard SeleniumConf 2012
  2. 2. What is Selenium Grid?• Maintain a clu ster of Seleniu m nod es• Configu re tests for d ifferent environm ents• Parallelize you r tests
  3. 3. How Does it Work?Seleniu m Grid H u b Seleniu m Grid N od e Seleniu m Server WebDriver WebDriver Brow ser Brow ser host_a Brow ser Client Client Client Client Seleniu m Grid N od e Seleniu m Server host_b Brow ser Brow ser Brow ser
  4. 4. Starting up our Hub• Prerequ isites: • A Java 5+ JRE • seleniu m -server-stand alone.jar• Ru n:$ java –jar selenium-server-standalone.jar –role hub
  5. 5. The Grid Console• Web console to see grid state and config• Open a w eb brow ser to: • http://localhost:4444/grid/console• Beta console available at: • http://localhost:4444/grid/beta/console
  6. 6. Configuring the Hub• Three options (in ord er of preced ence): • Grid 1 com patible YAML file • JSON configu ration file • Com m and -line flags• View current hu b config in console • Click “View Config” link
  7. 7. CLI Configuration• Find config option in console• H over over config nam e for valid options• Use that nam e as a CLI option• Exam ple to block u ntil a capability is p resent:$ java –jar selenium-server-standalone.jar –role hub –throwOnCapabilityNotPresent false
  8. 8. JSON Configuration• Each option in console is a JSON key w ith appropriate d ata type.• E.g., { “throwOnCapabilityNotPresent” : false }• Start the hu b w ith –hu bConfig option:$ java –jar selenium-server-standalone.jar –role hub –hubConfig hub_config.json
  9. 9. Grid1 YAML Config• Sam e config file form at as Seleniu m Grid 1• If you ’ve never used grid 1, d on’t w orry abou t it• Start the hu b w ith -grid 1Ym l option:$ java –jar selenium-server-standalone.jar –role hub –grid1Yml grid_configuration.yml
  10. 10. Starting up a Node• Prerequ isites: • A Java 5+ JRE • seleniu m -server-stand alone.jar• Ru n:$ java –jar selenium-server-standalone.jar –role node –hubHost localhost
  11. 11. Running a Browser Session• WebDriver • Alw ays use a Rem oteWebDriver• RC • N o special consid erations• Treat hu b as you r rem ote server• Let’s start u p Firefox on ou r grid
  12. 12. Configuring the Node• Tw o options (in ord er of preced ence): • JSON configu ration file • Com m and -line flags• View current nod e config in beta console • Click “Configu ration” tab for nod e
  13. 13. CLI Configuration• Find config option by ru nning w ith “-h” flag• Exam ple to change the p ort the nod e bind s to:$ java –jar selenium-server-standalone.jar –role node –hubHost localhost –port 5556
  14. 14. JSON Configuration• Each option in console is a JSON key w ith appropriate d ata type.• E.g., { “port” : 5556 }• Start the hu b w ith –nod eConfig option:$ java –jar selenium-server-standalone.jar –role node –nodeConfig node_config.json
  15. 15. Parallelizing Tests• Grid helps you organize resou rces and spread load• You still need to p arallelize you r tests• TestN G m akes this p retty straightforw ard• Ju nit is m ore w ork, bu t d oable • See article Ad am Gou cher w rote for Sau ceLabs’s blog• Ou tsid e the scope of this w orkshop
  16. 16. Extending Grid• Prim ary w ays to extend grid : • Contribu te a new servlet • Provid e a new Prioritizer im pl. • Provid e a new CapabilityMatcher im pl. • Provid e a new Rem oteProxy im pl.
  17. 17. Creating a New API Servlet • Any Servlet class w ill w ork • Su bclass RegistryBased Servlet to gain access to Registry (central grid d atastore) • Make su re it’s on the hu b’s classpath • Start hu b like so:$ java –cp selenium-server-standalone.jar:my_console.jarorg.openqa.grid.selenium.GridLauncher –role hub –servletscom.example.grid.servlets.Sessions
  18. 18. Let’s Build a Servlet• Will list all the ru nning test sessions• Retu rns resu lts in JSON • Provid es qu eryable API• Accessible from : • http://localhost:4444/grid/admin/Sessions
  19. 19. Altering Grid’s Execution• org.openqa.grid .internal.listeners.Prioritizer• org.openqa.grid .internal.u tils.CapabilityMatcher• org.openqa.grid .internal.Rem oteProxy
  20. 20. Prioritizer • Cu stom ize the execu tion ord er of tests • Com pares requ ests by d esired capabilities • Defau lts to FIFO behavior • Provid ed as hu b configu ration:$ java –cp selenium-server-standalone.jar:my_console.jarorg.openqa.grid.selenium.GridLauncher –role hub –prioritizercom.example.MyPrioritizer
  21. 21. CapabilityMatcher • Define custom strategy for m atching clients and nod es • Defau lt is any nod e that m atches d esired capabilities is a cand id ate • Provid ed as hu b configu ration:$ java –cp selenium-server-standalone.jar:my_console.jarorg.openqa.grid.selenium.GridLauncher –role hub–capabilityMatcher com.example.MyCapabilityMatcher
  22. 22. RemoteProxy• H u b’s interface to a nod e• Fu rther refined throu gh: • RegistrationListener • TestSessionListener • Com m and Listener • SelfH ealingProxy • Tim eou tListener • H tm lRend erer
  23. 23. RegistrationListener• Ru n ju st before a nod e is registered on the grid• Typical u ses: • Mod ify nod e’s configu ration • Facilitate m ass nod e m anagem ent
  24. 24. TestSessionListener• Ru n ju st before a test session is created• Ru n ju st after a test session end s• Typical u ses: • Gather inform ation abou t w hat ran on the nod e • Ensu re clean state of the OS
  25. 25. CommandListener• Ru n ju st before each com m and starts• Ru n ju st after each com m and finishes• Sim ilar to TestSessionListener bu t finer grain• Typical u ses: • Gather inform ation abou t w hat ran on the nod e • Ensu re clean state of the OS
  26. 26. SelfHealingProxy• Monitors grid health and takes corrective action• Defau lt & typical u se: • Ensu re hu b & nod es can talk to each other• You likely d on’t w ant to change the check, bu t m aybe the corrective action • E.g., restart VMs if nod e is d ow n
  27. 27. TimeoutListener• H and le client crashes• Defau lt & typical u se: • Shu td ow n any session that appears orphaned• You likely d on’t w ant to change the check, bu t m aybe the corrective action • E.g., restart VMs if nod e is d ow n
  28. 28. HtmlRender• N ot im plem ented by Rem oteProxy, bu t retu rned from it• Dictates how nod e is rend ered in Web console• Sim ple m ethod , very free-form• Mapping a custom servlet m ay m ake m ore sense
  29. 29. Let’s Build a RemoteProxy• Start by extend ing Defau ltRem oteProxy• We’ll interface w ith Brow serMob Proxy throu gh TestSessionListener • Start a new proxy on nod e the test w ill ru n on based on d esired capabilities • Stop proxy w hen the test session is over
  30. 30. Recap• Tod ay w e: • Set u p a sm all grid • Learned how to configu re the grid • Ran a brow ser session on the grid • Ad d ed a cu stom servlet to provid e a sim ple API • Created a cu stom Rem oteProxy to w ork w ith Brow serMob Proxy
  31. 31. The End• Qu estions?• Kevin Menard • kevin@m ogotest.com • Tw itter: @nirvd ru m • IRC: “nirvd ru m ” on FreeN od e channel #seleniu m

×