Alliance Successful Selenium Automation


Published on

How to develop a successful Selenium Automation Program

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Alliance Successful Selenium Automation

  1. 1. How to develop a successful SeleniumAutomation ProgramDave Rader - CTOSreekanth Singaraju – VP of Testing ServicesDATE: 6/28/2012
  2. 2. About AllianceAlliance Global Services is a software development firm that partners withsoftware, technology and information-intensive businesses on their mission-critical work.We plan, design, architect, build, test and implement software applications,platforms and products that become a primary driver of innovation and revenuegrowth for our clients’ businesses.We are recognized for driving quality and speed-to-market when businesssuccess depends on the software inside. We operate agile development centers in the United States and Hyderabad, India and have over 650 employees We have partnered with more than 400 innovative clients in the Information Services, Software and Technology, Insurance and Healthcare industries 2
  3. 3. Agenda• Definition of success• Impediments in Achieving Best in Class Automation• Challenges & Solutions for Selenium Automation• Key Takeaways• Titanium xAFT Overview 3
  4. 4. Definition of Success for an Automation Program Identifies defects of significance Effective and adopted by Developers & TestersThe framework should be of lowmaintenance and should not take Maintainsignificant effort to handle routinue ablechanges to AUT Automated test execution produces Robust consistent and provable results. Can be leveraged on different Re- releases, configurations & Usable environments. Test Ability to run Automated test scripts Independ ence cases in any order. Delivers measurable value in terms of decreased cycles of ROI execution, decreased effort and improved quality 4
  5. 5. Impediments to Achieving Best in Class AutomationObjectives Non-existent or Unrealistic automation objectives Focused around technical goals rather than business goalsAutomation Highest automation ROI areas not identifiedStrategy Subscale initiatives or insufficient commitmentStart-Up Tool licenses and framework creation costsCosts Up front Labor cost for implementing test casesExpertise & Manual test teams lack development expertiseAssets Knowledge of test case lifecycle mgmt. missingMeasuring Lack of a metrics program to measure alignment with overall objectivesEffectiveness Evaluate effectiveness of testing programs and fine-tune strategy 5
  6. 6. Challenges with Selenium AutomationObject Ability to identify Objects and manage them to limit the expenseReferences and effort to maintain updates to UICoding Develop scripts in a consistent and maintainable format forStandards easy maintenance and effective executionReporting Provide commercial quality reporting that enables testers to rapidly identify risks inherent in software and provide information to developers towards remediationFramework Implement a framework and process that will streamline management of common elements and resources in automation developmentExpertise & The ability to develop and maintain effectively automation andSkillset related assets to deliver ROI on automation investments 6
  7. 7. UI Object ReferenceMost of the Commercial automation tools have the provision to create and manage UI objectsin a centralized repository. Selenium has limited tools to address this leading to high-maintenance scripts • Object reference created using XPATH, ID, Name, Class or CSS. Common mistakes in constructing Object references • Improper selection of Object selection property type • Duplicate references to same objects • Full length XPATH from root used for object identification • Leading to brittle references that break when minor changes to UI are implemented • Significant maintenance effort when UI is redesigned //html/body/div/div/div[2]/ui/div/div[2]/div/h2/a 7
  8. 8. UI Object Reference – Recommendations • Utilize common stored location for objects using logical names • Use Key-Value-Pair combination for Logical name and Object identification • Logical hierarchies to group objects for same features at the same place • Recommend UI developers use frameworks that provide unique identifiers for controls • Use the smart identification mechanism and use the optimized XPATH //div[@id=’icon-edit’/h2/a 8
  9. 9. Coding PracticesTest engineers that perform script development on Selenium may not have formaldevelopment training leading to common coding errors. These lead to expensive maintenancewhen the scripts need to be updated or unexplained behavior for execution • Not using a design pattern or development strategies to selenium.type("name=j_username", develop framework and scripts "user1"); selenium.type("name=j_password", "user123); • No exception catching block in"divdiv[1]spanlogin the coding "); Thread.sleep(30000); • Use of Objects reference such as"class=Compose_Email"); path/xPATH in the code • Use of hard coded values for the data for inputs and validation 9
  10. 10. Coding Practices – Recommendations • Using a design pattern and development strategies like Page Object Model OR Domain Driven Designtry {//Login to the system and Verify Email • Utilize code style/quality checkingselenium.type(userNameLocator,userNamevalue); tools to address:selenium.type(passwordLocator,passwordvalu • Exception handlinge);; • Commenting • Hard codingselenium.isTextPresent(welcomeText);} catch (Exception e) { • Use reusable coding practices forLogger.Debug(("Element :["+ welcomeText+"not found" + handling input data, validations,"continuing text execution")); object references and"Compose_Email"); library functions} • Utilize reference based object synchronization for script to synchronize with the app 10
  11. 11. Reporting & MetricsMost of the Commercial automation tools provide extensive reporting functionality is notavailable in Selenium and needs to be developed • Poring over logs to identify exceptions is time consuming and error prone • Execution metrics such as coverage, script effectiveness etc help fine-tune framework • Test Execution meta data such as environments, browsers, pass/fail etc need to be extracted from the basic logs • Mapping of pass/fail data to validation points needs to be created • Fatures such as screenshots are completely missing 11
  12. 12. Reporting & Metrics • Multiple levels of logging for easy debugging and analysis • Drill down Test Result reports • Automatic Emailing the Test Result Reports • Test Result Report Integration with Test Case Management Tools • Screenshot capture on every step or on exception • Defect identification effectiveness, designed coverage and traceability to features 12
  13. 13. Automation FrameworkPoorly designed automation frameworks only transfer inefficiencies from scripts to theframework while providing limited benefits An example of a poorly designed framework: • Poor architecture design limiting Automation flexibility of choosing target Framework: Target browsers, target environments Browsers, Test Data, and test data suites Object References, • Lack of standards and guidelines Reusable Functions, for reusable functions, Exception Handling, components and object references Reporting • Reporting features limited to logs from Selenium • Weak governance leading to diluted framework effectiveness 13
  14. 14. Automation Framework • Framework should be application- independent. Configuration • Easy to expand, maintain, and Files perpetuate as the underlying application changes • Generic functionality like navigation, API Support Test Data link checking, login/logout and reports should be developed as Application reusable functions Specific Business Functions • Business functionality will be addressed in test scripts/suites Logging and Object • Test Data treated as a separate Reporting Repository input into scripts • Implement support for Windows File Generic and Authentication dialogs Functions • Scripts should have minimal external dependencies from: – Browser versions – Target environments 14
  15. 15. Expertise & SkillsetCurrently there are a lot of good developers and good testers – but it is very hard to find goodautomation Engineers that can develop effective automation Developers • Facilitate the creation of automation testers by Automation creating a cross Engineer functional/technical Tester training • Support them with robust automation frameworks and reusable assets • Ultimately Expensive to hire, maintain and retain resources 15
  16. 16. Key Take AwaysExisting Run scripts on more than one browserAutomationProgram Run Sonar and identify code quality issues Metrics and reports from framework Validate scripts can run multiple data conditions with no code changes Change IDs for a few UI controls and evaluate impact on scripts Governance and process on managing frameworkNew Review off-the-shelf automation frameworks first before building fromAutomation scratchProgram 16
  17. 17. Titanium xAFT OverviewxAFT is a Selenium based Automation tool to test web based applications from anExcel worksheet using English like language. Based on Open and proven 30% productivity technologies improvements over Selenium automation Flexible & Maintainable framework Execute scripts from Excel Across browsers Titanium xAFT (eXcel Automated Functional Tester) is a and web services robust enterprise automation framework that enables technical and non-technical users to manage and leverage automation suites Web Mobile WebServices 17
  18. 18. Thank You 18