Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Test Automation Framework Development Introduction

970 vues

Publié le

Test Automation framework development introduction - Data Driven Framework

Publié dans : Technologie
  • Identifiez-vous pour voir les commentaires

Test Automation Framework Development Introduction

  1. 1. Test Automation Framework Introduction – Data Driven (Free to Share/View/Download) Presenter : Ganuka Yashantha © Ganuka Yashantha | ganuyash@gmail.com
  2. 2. Contents 1. Software Framework 2. Selenium 2.0 What is Selenium What we use Advantages of WebDriver 1. The Better Way Introduction PageObject Pattern 1. Automation Framework Approaches Data/Table Driven Framework Lessons Learnt Test Organization Test Writing Style Note © Ganuka Yashantha | ganuyash@gmail.com
  3. 3. Software Test Framework What is a software test framework? 1 © Ganuka Yashantha | ganuyash@gmail.com
  4. 4. Software Test Framework The definition and key components A software test framework is a universal, reusable software platform used to develop applications, products and solutions (Wikipedia, 2012). Software Test Frameworks include,  Support Programs  Compilers  Code Libraries  APIs  A tool set to integrate different components © Ganuka Yashantha | ganuyash@gmail.com
  5. 5. Software Framework Framework properties A Software Test framework contain key distinguishing features that separate them from normal libraries. They are,  Inversion of Control (IOC) the overall program's flow of control is not dictated by the caller, but by the framework.  Default behaviour must actually be some useful behavior and not a series of instructions.  Extensibility can be extended by the user usually by selective overriding or specialized by user code providing specific functionality.  Non modifiable framework code is not allowed to be modified. © Ganuka Yashantha | ganuyash@gmail.com
  6. 6. SELENIUM 2.0 What is the easy way to automate? 2© Ganuka Yashantha | ganuyash@gmail.com
  7. 7. The easy way Records all user activities and play back Selenium IDE is an integrated development environment for Selenium scripts. It is implemented as a Firefox extension, and allows you to record, edit, and debug tests. Later, the recorded events are played back and various assertions are made to ensure the output matches that which is expected. © Ganuka Yashantha | ganuyash@gmail.com
  8. 8. What is Selenium ?  create quick bug reproduction scripts  create scripts to aid in automation-aided exploratory testing Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes  create robust, browser- based regression automation  scale and distribute scripts across many environments Selenium IDE Selenium WebDriver © Ganuka Yashantha | ganuyash@gmail.com
  9. 9. What we Use ? Selenium WebDriver  This is commonly referred to as just "WebDriver" or sometimes as “Selenium 2”  Selenium 1.0 + WebDriver = Selenium 2.0  Tests should be written in Java, the implementing classes one should use are listed as below: AndroidDriver, ChromeDriver , EventFiringWebDriver, FirefoxDriver, HtmlUnitDriver, InternetExplorerDriver, PhantomJSDriver, RemoteWebDriver, SafariDriver © Ganuka Yashantha | ganuyash@gmail.com
  10. 10. Advantages of WebDriver Better error handling.  You can wrap you calls in try/catch blocks and have recovery routines. Reusable modules.  PageObject, Reusable flow models, Fixtures and Factories, data processing, object handling utilities, etc Ability to tap into coordinate stuff outside of web browser. Very mature and complete API In Sept 2010, supports JavaScript alerts and confirms better © Ganuka Yashantha | ganuyash@gmail.com
  11. 11. The Better Way What could be a better way of automating? 3© Ganuka Yashantha | ganuyash@gmail.com
  12. 12. The better way Introduction Treat automated testing as software development. Tests should be created with the same concern for software design principles such as, • Reduced coupling • High cohesion • Proper separation of concerns • Maintainability • Reusability © Ganuka Yashantha | ganuyash@gmail.com
  13. 13. Automation Framework Approaches Generic Architecture A Test Automation Framework should have a multi- tiered architecture. It should consists of the following tiers.  Engine Components in this tier are completely responsible for interacting with the WebDriver interfaces.  Domain This tier is meant to contain only page objects that work against the engine.  Utils This tier is meant to contain very generic, reusable functionality across all the other tiers.  Functional Tests This tier will contain tests that are built on top of other tiers to create actual test scenarios by using page objects in the Domain. Test Automation FrameworkTest Automation Framework Functional Tests(Business Logic)Functional Tests(Business Logic) Domain(Page Object) Engine UtilsUtils Selenium Web Driver APISelenium Web Driver API DataObjectDataObject TestNG FrameWorkTestNG FrameWork © Ganuka Yashantha | ganuyash@gmail.com
  14. 14. Page Object Design Pattern  The Page Object pattern represents the screens of your web app as a series of objects and encapsulates the features represented by a page.  It allows us to model the UI in our tests.  A page object is an object-oriented class that serves as an interface to a page clickLogin –Directing to Home Page enterPassword enterUserName © Ganuka Yashantha | ganuyash@gmail.com
  15. 15. The better way PageObject class more… © Ganuka Yashantha | ganuyash@gmail.com Once new Element added to the DOM below Xpaths’ can be changed….
  16. 16. DataObject Class Getter and Setters Test Data © Ganuka Yashantha | ganuyash@gmail.com
  17. 17. Test Data Generation Useful When Test Data Generating  Preparing proper test data is a core part of testing.  Especially when you do Functional Automation testing or Performance testing you will need large number of data set.  Using following links you can make it more handily • http://www.mockaroo.com/#tab_all • http://www.generatedata.com/ © Ganuka Yashantha | ganuyash@gmail.com
  18. 18. TestExecution Class © Ganuka Yashantha | ganuyash@gmail.com Data passing from Data Object Creating login data Object Using LoginPageObject to navigate Normal Test Execution
  19. 19. Engine Continues …. © Ganuka Yashantha | ganuyash@gmail.com
  20. 20. The better way Things to Remember…. In PageObjects, • The public methods represent the services that the page offers • Try to stick to the ID and Name when Accessing Elements.(FindElementBy.id or FindElementBy.name) • Changes in UI’s having a direct impact on the PageObject Classes • Methods return other PageObjects, if functionality changed there can be plenty of changes in DataObjects, PageObjects and Business Logic as well. • If there are dynamic web elements, changes in those have a impact on Excel Data sources, Data Object and PageObject. • Different results for the same action are modeled as different methods © Ganuka Yashantha | ganuyash@gmail.com
  21. 21. Automation Framework Different type of automation frameworks? 4© Ganuka Yashantha | ganuyash@gmail.com
  22. 22. Automation Framework Approaches Data Driven Framework Data driven is the design of possible inputs what may given by the end user. This would cover maximum probabilities of an input data. It can be a spread sheet or a DB. We have to connect and pass the values to the respective field or element. • Take advantage of tester’s familiarity with test case creation using tables and matrices • Accommodate localization projects • Recognize the importance of patterns in test cases • Enable testers to catalog test cases with Excel spreadsheets • Enable testers to specify expected results in spreadsheets © Ganuka Yashantha | ganuyash@gmail.com
  23. 23. Lessons Learnt Some important points to keep in mind © Ganuka Yashantha | ganuyash@gmail.com
  24. 24. Notes … .. .  Referred selector order : id > name > css > xpath  Using ID as a selector is the best Practise.  If there are changes in Selectors, communicate among the QAs’ and it’s important to prevent the test failures.  Automated Test Can be flailed due to : • Selector Changes (id/name/css/xpath) • Functionality Changes (business logic) • Data Provider failures (updating fields/adding new fields, etc) • External Data Level(XML Changes) Changes © Ganuka Yashantha | ganuyash@gmail.com
  25. 25. When new Element added to the Navigation Panel Xpath of the “User Details’’ Element Can be changed. © Ganuka Yashantha | ganuyash@gmail.com Scripts can fail 
  26. 26. When using ID’s © Ganuka Yashantha | ganuyash@gmail.com   
  27. 27. Thank You © Ganuka Yashantha | ganuyash@gmail.com