Gilt Groupe's Selenium 2 Conversion Challenges
 

Like this? Share it with your network

Share

Gilt Groupe's Selenium 2 Conversion Challenges

on

  • 2,740 views

See some of the lessons learned by Gilt Groupe as they converted from Selenium 1 to Selenium 2.

See some of the lessons learned by Gilt Groupe as they converted from Selenium 1 to Selenium 2.

Statistics

Views

Total Views
2,740
Views on SlideShare
2,008
Embed Views
732

Actions

Likes
2
Downloads
15
Comments
0

2 Embeds 732

http://www.sujitnayak.com 730
http://prlog.ru 2

Accessibility

Categories

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.

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

Gilt Groupe's Selenium 2 Conversion Challenges Presentation Transcript

  • 1. Findings  and  Challenges  
  • 2.   Background    Tools    Past    Challenges    “The  Decision”      Benefits    Conversion    Present    Examples  
  • 3.   Custom  framework  written  in  Java    In  house  test  management  system     TestElements   ▪  Projects   ▪  Test  Suites     Test  Cases     Actions     Data  Elements     Object  Store    Fully  integrated  with  our  Framework  
  • 4.   Eclipse  IDE    TestElements    Results  Viewer     +  iPad  version    SauceLabs    SeleniumIDE    Firebug    Ivy    Git  -­‐  version  control  
  • 5.   Selenium  1  &  Selenium  Grid     6  lab  machines   ▪  Mac’s  and  PCs  with  different  browser  combinations     RC  for  each  desired  browser  on  local  machines     RC  for  each  desired  browser  on  each  remote   machine  running  on  SeleniumGrid  
  • 6.   Maintenance  of  RC’s    If  1  RC  had  an  issue,  must  kill  all  RC’s,  restart   HUB,  and  restart  each  one  again    >  800  test  cases  executed  amongst  6   machines  multiple  times  a  day   ▪  (approx.  2500/day)    Parallel  execution  was  challenging     Cross  browser  testing  
  • 7.   Solved  every  challenge  on  the  list    Selenium  RC’s  in  the  cloud     No  maintenance    Video    Replaced  Selenium  with   WebDriverBackedSelenium     Selenium  1  backwards  compatible    New  code  would  use  WebDriver  
  • 8.   WebDriverBackedSelenium  on  Sauce     Each  selenium  1  command  would  spit  back   javascript,  causing  very  slow  test  execution  times     WebDriver  commands  were  OK    Did  not  realize  this  right  away    Santiago  the  ‘Sauce  Ninja’  
  • 9.   Convert  EVERYTHING…    No  more  XPATH!     CSS_SELECTOR   ▪  Native  support  on  each  browser     ID     LINK_TEXT  
  • 10.   Improve  execution  speed  on  Sauce       (no  more  JavaScript)    Better  emulation  of  user  interactions    Better  API  –  More  object  oriented    Stability    Improve  logic  in  codebase    Don’t  want  to  be  left  behind    New  version  of  Selenium  all  the  time     Bug  fixes,  improvements     Feel  they  care  about  the  product    Fun  
  • 11.   Line  by  Line  conversion     remove  any  selenium1  references    Not  enough  documentation  existed    Not  everything  appeared  to  be  easily   converted     hover  /  mouseOver     select  from  combo  box     attachFile  
  • 12.   Different  functionality     Objects  must  be  visible  before  acting  on  them     Type  mechanism  does  not  clear  the  text  field   before  filling  it  out  *  changed  in  2.6     Selenium2  is  blocking   ▪  No  more  waitForPageToLoad(….)       Use  ExpectedCondition  class  to  wait  for   presence  /  visibility  of  element    Different  names     no  more  isElementPresent  /  isVisible    
  • 13.   Simplify  codebase    Find  Selenium2  conversion  for  everything   and  create  wrapper  in  our  Framework    SeleniumBase.java  was  born     Custom  WebDriver  commands     All  scripts  extend  from  this  class     Less  clutter     Maintainability  
  • 14. public WebDriver getWebDriver() { return webDriver; } public WebElement getWebElement(LocatorType locatorType, String locator) throws Exception { return getWebDriver().findElement(by(locatorType, locator)); } public List<WebElement> getWebElements(LocatorType locatorType, String locator) throws Exception { return getWebDriver().findElements(by(locatorType, locator)); } public boolean isElementPresent(LocatorType locatorType, String locator) throws Exception { return getWebElements(locatorType,locator).size() > 0; } public boolean isVisible(LocatorType locatorType, String locator) throws Exception { return getWebElement(locatorType,locator).isDisplayed(); } public void waitForElementPresent(final LocatorType locatorType, final String locator) throws Exception { getWait().until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { try { return isElementPresent(locatorType, locator); } catch (Exception e) { return false; } } }); }  
  • 15. public void clearAndSendKeys(LocatorType locatorType, String locator, String keys) throws Exception { getWebElement(locatorType, locator).clear(); getWebElement(locatorType, locator).sendKeys(keys); } public void check(LocatorType locatorType, String locator) throws Exception { if(!getWebElement(locatorType, locator).isSelected()) getWebElement(locatorType, locator).click(); } public void mouseOver(LocatorType locatorType, String locator) throws Exception{ Actions action = new Actions(getWebDriver()); action.moveToElement(getWebElement(locatorType, locator)).perform(); } public void selectComboBoxByVisibleText(LocatorType locatorType, String locator, String value) throws Exception{ Select comboBox = new Select(getWebElement(locatorType, locator)); comboBox.selectByVisibleText(value); } public void switchToWindow(String windowTitle){ Set<String> windowHandles = getWebDriver().getWindowHandles(); Iterator<String> iter = windowHandles.iterator(); while(iter.hasNext()){ String currentWindowHandle = iter.next(); getWebDriver().switchTo().window(currentWindowHandle); if(getWebDriver().getTitle().equals(windowTitle)) break; } }  
  • 16. clearAndSendKeys(LocatorType.ID,"Gilt Login Page","Email Address Text Field”,emailAddress); clearAndSendKeys(LocatorType.ID,"Gilt Login Page","Password Text Field”,password); getWebElement(LocatorType.ID,"Gilt Login Page","Sign In Button").click();
  • 17. waitForElementPresentAndVisible(LocatorType.CSS_SELECTOR,"Gilt Carousel Bar","Selected Tab"); mouseOver(LocatorType.CSS_SELECTOR,"Gilt Carousel Bar","Selected Tab"); List<WebElement> saleTitle = getWebElements(LocatorType.CSS_SELECTOR,"Gilt Carousel Bar","Selected Tab Sale Links");  
  • 18. List<WebElement> productLookTitleAll = getWebElements(LocatorType.CSS_SELECTOR,"Gilt Product Listing Page","Product Look Title Links"); List<WebElement> productLookTitleAvailable = getWebElements(LocatorType.CSS_SELECTOR,"Gilt Product Listing Page","Available Product Look Title Links"); List<WebElement> productLookSoldOut = getWebElements(LocatorType.CSS_SELECTOR,"Gilt Product Listing Page","Sold Out Product Look Title Links");  
  • 19.   99.9999%  converted  to  Selenium2   ▪  attachFile()    Stable  results    Clean,  easy  to  manage  code    SeleniumBase  continues  to  grow    Ivy  to  manage  dependencies     Upgrade  to  Selenium  2.x  quickly     Push  changes  to  team  through  Git  
  • 20.   Make  the  switch     Spread  the  work  out  to  save  time    Be  aware  of  the  differences  b/t  Sel1  and  Sel2     More  documentation    Modularize  common  selenium  commands    Selenium  Users  google  group  
  • 21.   Question???    Comments….  Email:  jsanchez@gilt.com    Invitation:  http://www.gilt.com/invite/josesanchez