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.

Mastering selenium for automated acceptance tests

21,749 views

Published on

Published in: Technology
  • D0WNL0AD FULL ▶ ▶ ▶ ▶ http://1lite.top/pCzSB ◀ ◀ ◀ ◀
       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
  • 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
  • DOWNLOAD FULL. BOOKS INTO AVAILABLE FORMAT, ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • SAP Simple Finance, SAP Success Factors, SAP HANA, Fiori, BPC, SAP MM, SAP FICO, GST, SAP SD, SAP Basis, Training in Chennai & Bangalore India Online/Class Room. The Reach @ 8122241286 or 9003085882. http://www.thecreatingexperts.com People from HR,Fianance,Manufacturing, Logistics, Sales, Customer Care & IT, ITES,BPO, Industries can learn SAP Technology to Get High Pay Salary with long term career Growth. Best SAP Training Institute in Chennai with Placement Support
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Mastering selenium for automated acceptance tests

  1. Nick Belhomme January 26th, PHPBenelux Conference 2013, Belgium
  2. Nick BelhommeInternational Conference SpeakerContributor to various Open SourceProjectsBuilding ConstructorSoftware Architect / Project LeadLoving HusbandFreelance PHP ConsultantPHP QA trainerYour host for the upcoming hour
  3. Selenium 34 Claims, Benefits: Prevents cancer Aging
  4. Selenium – the web browserautomation tool set
  5. Acceptance Tests● System tests● Black box● Functional testing
  6. Browser Compatibility Tests● Different Browsers● Different Operating Systems
  7. Regression Tests● Internal Changes● Partner Changes
  8. Tools● Humans● Capture and replay● Scripts and bots● Selenium
  9. Manual Testing● Time-intensive● Nerve-stretching● Human error / understanding of the flow● Costly
  10. Capture and Replay● Captures mouse movements and inputs● Replays later● Screenresolution, operating systems, window sizes, makes this very unmaintainable
  11. Scripts and Bots● Bot makes screen-shots, analyzes them for visual blocks● Calculates visual blocks x-y positions and generates mouse clicks on that location and user input.● Generating a test is time-intensive● Error prone on design changes.
  12. Selenium● Records and playback browser tests● Asserts on DOM● Javascript is being executed and testable● Css selectors or xpath position sensitive● Hard to detect layout errors
  13. Learning Curve● Jump in quickly● Steep – If you want to do it right● Mastering it – creating readable, understandable, maintainable and robust tests - takes time and effort.
  14. Worth it Ask a Salary Increase and own a second modest vacation property
  15. And as an added bonus● Better code architecture● More functional code● High browser compatibility● No more regressions● Neat cool stuff to brag about at your local pub!!!
  16. Setting it up client side
  17. Selenium IDE Firefox Plugin: http://release.seleniumhq.org/selenium-ide/1.10.0/selenium-ide-1.10.0.xpi● Easy record and playback● Intelligent field selection will use IDs, names, or XPath as needed● Autocomplete for all common Selenium commands● Walk through tests● Debug and set breakpoints● Save tests as HTML, PHPUnit, or any other format● Support for Selenium user-extensions.js file● Option to automatically assert the title of every page● Easy customization through plugins
  18. Selenium IDE
  19. Test Suite Control Flow
  20. X-forwarding run software on remote machine and display the GUI locally● Linux and Mac OS X support X Forwarding with no extra software ssh -X● Windows needs extra software Xming
  21. Xming (X-forwarding for windows)http://sourceforge.net/projects/xming/files/latest/downloadConfigure Xming Windows Start => Xming => XLaunch Display settings dialog box: Multiple windows Display number as 0 Keep clicking next then Finish.
  22. Putty (windows)● Connection => SSH => X11● Enable X11 forwarding● Set X display location as :0.0
  23. Setting it up server side (headless)
  24. Firefox● [64 bit] wget http://download-origin.cdn.mozilla.net/pub/mozilla.org/firefox/relea● [32 bit] wget http://download-origin.cdn.mozilla.net/pub/mozilla.org/firefox/relea● tar -jxvf firefox-18.0.tar.bz2 -C /opt● ln -s /opt/firefox/firefox /usr/bin/firefox● Firefox (No X-Display needed thanks to forwarding)
  25. Completely headless (no X-forwarding)● Install Xvfb aptitude install Xvfb● Update to latest java version aptitude install sun-java6-jre● Download the latest Selenium Server Jar package wget http://selenium.googlecode.com/files/selenium- server-standalone-2.28.0.jar
  26. Test driving Selenium RC (X-forwarding)To test-drive it is always easier to first use X-forwarding:java -jar selenium-server-standalone-2.28.0.jar -htmlSuite*firefox "http://www.domaintocheck.com"“/path/to/selenium/testSuite.html”“/path/where/selenium/should/store/results.html”testSuite.html and related files are the files saved by Selenium IDE
  27. Test driving Selenium RC (X Virtual Frame Buffer)● Open a connection and run Xvfb Xvfb :99● Open another connection and run selenium export DISPLAY=:99 & java -jar selenium-server- standalone-2.28.0.jar -htmlSuite *firefox "http://www.domaintocheck.com" “/path/to/selenium/testSuite.html” “/path/where/selenium/should/store/results.html”
  28. Integrate into Make certain your Jenkins server is started with Xvfb run on :99 ● Check with: ps -ef | grep Xvfb ● If not running then issue a Xvfb :99 CTRL + Z● Log into Jenkins: manage Jenkins -> Manage Plugins install “Hudson Seleniumhq plugin”
  29. Setup a Job● Create a new freestyle job
  30. Problem● remote control is slow at driving the browser.● limited number of concurrent tests on the same remote control before seriously impacting its stability.● Multiple Selenium Remote Controls In Jenkins to work around the limitation on the number of parallel tests.
  31. The Grid● Run tests against multiple browsers● multiple versions of browser● browsers running on different operating systems● To reduce the time it takes for the test suite to complete a test pass.
  32. The Hub● 1 instance● Allocating a Selenium Remote Control to a specific test (transparently)● Limiting the number of concurrent test runs on each Remote Control● Shielding the tests from the actual grid infrastructure
  33. A Node● Remote Control● Multiple instances (across machines preferably)● Multiple Browsers● Can be configured using a json file
  34. Setting up the grid
  35. ● Start the hub java -jar selenium-server-standalone-2.28.0.jar -role hub● Start nodes on separate machines java -jar selenium-server-standalone-2.28.0.jar -role node -hub http://hub-address:4444/grid/register
  36. http://hub-address:4444/grid/console
  37. Optimizing a Node with js ● java -jar selenium-server-standalone-2.28.0.jar -role node -nodeConfig nodeConfig.js //nodeConfig.js{ "class":"org.openqa.grid.common.RegistrationRequest", "capabilities":[ { "platform":"VISTA", "seleniumProtocol":"Selenium", "browserName":"*firefox", "maxInstances":5 }, { "platform":"VISTA", "seleniumProtocol":"Selenium", "browserName":"*iexplore", "maxInstances":1 } ],
  38. "configuration":{ "port":5555, "register":true, "host":"node-address", "proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession":5, "role":"node", "hubHost":"hub-address", "registerCycle":5000, "hub":"http://hub-address:4444/grid/register", "hubPort":4444, "url":"http://node-address:5555", "remoteHost":"http://node-address:5555" }}
  39. http://hub-address:4444/grid/console
  40. Run the suite● No Native HTML Selenese tests support● Web driver needed● PHPUnit
  41. + Selenium Web Driverwget http://pear.phpunit.de/get/phpunit.pharchmod +x phpunit.phar
  42. Selenium-ide-php-formattersConvert Html Selenese tests to PHPUnit testcasesFirefox Addon:https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/
  43. Export the Test Cases
  44. The test case<?phpclass Example extends PHPUnit_Extensions_SeleniumTestCase{ protected function setUp() { $this->setBrowser("*iexplore"); $this->setBrowserUrl("http://www.nickbelhomme.com/"); } public function testMyTestCase() { $this->open("/"); $this->assertTrue($this->isElementPresent("link=About")); $this->assertTrue($this->isElementPresent("link=Consulting & Training")); $this->assertTrue($this->isElementPresent("link=Blog")); $this->assertTrue($this->isElementPresent("link=Contact")); $name = $this->getEval(""nick"==="nick""); }}?>
  45. Run the test casephp phpunit.phar testcases/testMenu.php Run the test suite php phpunit.phar testcases
  46. Use multiple browserspublic static $browsers = array( array( name => Firefox, browser => *firefox, host => hub-address, port => 4444, timeout => 30000, ), array( name => Internet Explorer, browser => *iexplore, host => hub-address, port => 4444, timeout => 30000, ));protected function setUp(){ $this->setBrowserUrl(http://www.example.com/);}
  47. Use raw Html Selenese test public function testMenu() { $this->runSelenese(testMenu.html) }Use raw Html Selenese testsuite public static $seleneseDirectory = /path/to/files;
  48. Taking it Parallel
  49. With Paratest Parallel PHPUnit – running tests concurrently● Support for annotated tests● Inheritance● Tests suites● Test methods● Reflection driven
  50. composer install // composer.json{ "require": { "brianium/paratest": "dev-master", "phpunit/dbunit": ">=1.2", "phpunit/php-invoker": "*", "phpunit/phpunit-selenium": ">=1.2", "phpunit/phpunit-story": "*" }}
  51. PHPUnitParatest + PHPUnit
  52. References● X-Forwarding: http://en.gentoo-wiki.com/wiki/X-Forwarding http://www.straightrunning.com/XmingNotes/● Xvfb http://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml● Driving Selenium with PHPUnit http://www.phpunit.de/manual/3.8/en/selenium.html● Selenium Hq http://seleniumhq.org/docs/index.jsp● Composer http://getcomposer.org● Paratest http://brianscaturro.com/2012/11/02/parallel-phpunit.html
  53. Troubleshooting● Firefox install dependencies http://www.thinkplexx.com/learn/howto/linux/system/installing- and-running-firefox-on-debian-linux-getting-missing- dependencies-shared-libs● Specify different ports in Jenkins for each RC when not using the grid● Proxy settings in Browser – use X-Forwarding to run Browser and change settings, use profile as a RC param when needed.
  54. Link to slides and other updates is available athttp://www.facebook.com/NickBelhommeFanPage
  55. The End! THANK YOU Please rate my talk https://joind.in/7796contact@nickbelhomme.comSlideshare, Twitter, IRC: NickBelhommehttp://blog.nickbelhomme.com
  56. Flickr Photo CreditsBackgrounds by Flikr http://www.flickr.com/photos/flikr/146538982/ http://www.flickr.com/photos/flikr/147274362/

×