• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Web Testen mit Selenium

on

  • 4,091 views

 

Statistics

Views

Total Views
4,091
Views on SlideShare
4,070
Embed Views
21

Actions

Likes
0
Downloads
136
Comments
0

2 Embeds 21

http://static.slidesharecdn.com 14
http://web.openforce.com 7

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

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
  • I show here the IDE in Firefox – how it functions for a login page and the generated java file.

Web Testen mit Selenium Web Testen mit Selenium Presentation Transcript

  • Selenium Automation Testing with Selenium Wien, 21. Oktober, 2010 Monica Nanu
  • Summary
    • Selenium – General overview
    • Risks and structuring the test project
    • Showcase: Implementation for TEMPO
  • Selenium – General Overview
      • What is Selenium? The Selenium components
      • Steps in developing automation tests
      • Future development – Selenium 2.0
    • Selenium is a suite of tools to automate web application testing across many platforms .
      • What is Selenium
        • Framework for automation testing tool for web applications
        • IDE for record / playback -> creation of tests -> learning language
        • DSL for writing test scripts in Java, Ruby and others
        • Support for all major browsers
      • Selenium components
        • Selenium IDE
        • Selenium Remote Control
        • Selenium Grid
    Selenium – General Overview
  • Steps: Selenium IDE: Record and playback Selenium IDE: Export as Java code Selenium RC: Execute Java(Eclipse-Junit) Selenium GRID: distribute on various environments demo: Selenium IDE: record, replay and export Selenium – General Overview
  • Selenium commands (Selenese) A set of commands that run the tests for a web-based application:
    • check if the correct UI elements exist;
    • check the specific content of the UI elements;
    • check that all links are functional;
    • check data entry field (input of data and check of the values);
    • checks the option selection on different UI elements (radio buttons, check boxes, drop down lists);
    • checks the form submit options;
    • check for applications using Ajax calls.
    There are 3 Types of commands:
    • Actions - commands that manage the state of the application
    “ click link”, “select option”, Fail = the execution of the test case stops/ends, ...AndWait – a post-back is set and Selenium waits until the execution is completed
    • Accessors – check the state of the variables that are used in Assert commands
    • Assertions – check that the state of the aplication is exactly what and how is expected. E.g.. “the title of the page is ”abc” or that “checkbox is selected”. There are 3 methods to check:
      • “ assert” (the test stops),
      • “ verify”(error is logged and the test continues )
      • ” waitFor” (awaits until a restriction is aquired – used for testing applications with AJAX).
    Selenium – General Overview
    • Client library : Transforms the Java calls into server commands, by encoding it into the “Selenese” network protocol (on top of HTTP) and sending it to the Selenium server.
    E.g. “start browser”, “click-to”...
    • Server component : Listens for commands from clients (on a TCP socket) and performs actions accordingly.
    E.g. starting web-browser or forwarding “user interaction” to the web-browser and delivering back the result to the client. Selenium – General Overview
      • S peeds up functional testing of web-applications by leveraging the existing computing infrastructure;
      • Allows easily running multiple tests in parallel, on multiple machines, in an heterogeneous environment;
      • Allows running multiple instances of Selenium Remote Control in parallel. Even better, it makes all these Selenium Remote Controls appear as a single one, so the tests do not have to worry about the actual infrastructure;
      • Selenium Grid cuts down on the time required to run a Selenium test suite to a fraction of the time that a single instance of Selenium instance would take to run.
    Selenium – General Overview
  • Strong Points:
      • Open source tool for web application (no license costs, large community for support and continuous development);
      • support for multi platform and multi browser in terms of coverage;
      • DOM testing – simple and strong;
      • The TC are stable, for mature versions;
      • Supports testing AJAX applications;
      • Allows building flexible testing scenarios within the power of Java.
    Weak Points:
      • Error diagnoze and reporting;
      • Upon UI changes, the scripts need update (general for all automation tools)‏;
      • It is state dependent (html driven)‏;
      • May require more knowledge (learning effort may be high in the beginning)‏.
    Future and actual Selenium projects:
      • Selenium 2.0 (Selenium + WebDriver)
    Drivers: HtmlUnit / Firefox / IE / Chrome
      • Selenium Logging – utility for RC for creating reports in html format, including time measurement and automatic screenshots (http://loggingselenium.sourceforge.net/usage.html).
    Selenium – review
  • Starting point: Test Plan
      • Functionality tree and initial evaluation of total effort (main functionalities and test cases)
    Manual versus Automation testing
        • Risk evaluation
        • Decision for the solution of automation testing
      • GUI and usability
      • Performance
      • Regressions and others
    Main risks to evaluate for automation:
      • No automation - The quality of the testing and the time invested
      • The cost of development and maintenance of the automated tests
    Result: We implement the automation testing in a structured layered architecture using Selenium Selenium – review
  • Test Project Structure Working together with Development and QA to implement the test framework structure.
      • separate test-framework code from the actual tests classes
      • separating reusable, generic test-framework code from a project specific code
  • Tempo Project Tempo – a story about time
      • Purpose of the application
      • Possible user scenarios – as acceptance tests
      • Structure considered for testing
    Demo of the Tempo project
  • Identifying the page and panes objects for testing structure – Time Tracking page Tempo Project Time Tracking Page Time Tracking Pane Time List Pane Tag Pane Live View Pane
  • Diagram of tempo test project This is where QA designs the tests.
    • complex functionalities covering the usage of the application;
    • specific user scenario or a combination of possible user actions;
    • validation data in one or more test classes;
    • data driven testing, when needed.
    DEV and partly QA
    • Pages - Java class for each page under test with the UI elements to be verified and all methods that are used further in the tests;
    • Panes – Java classes for each panes identified in the pages and the verifying methods for each action;
    • Common - generic functionality executed in more pages or all pages e.g. navigation between all pages, cleaning/ preparing the database for tests, auto login executed before testing any page, others.
    Adapting Selenium
    • Elements: classes for basic HTML elements such as text field, check box, radio button, etc that encourage OO test code);
    • Browser Driver: browser driver utility (class) that builds an abstraction layer for selenium RC for controlling the browser (e.g. start, stop) and for implementing user actions methods (e.g. click, type text);
    • Extending the element location strategy by Injecting the entire jQuery framework into pages under test, in order to verify visibility of elements that appear after dynamic HTML or Ajax calls.
    Tempo Project
  • Use case: Open Time Tracking page and register the time in TEMPO application (time punch, time stamps, interval, duration). Check the results on the page.
    • instantiate page object TimeTrackingPage and within it we:
    • instantiate TimeTrackingPane – create new time stamp
    • instantiate TimeListPane – test that a new time stamp is listed
    • Instantiate TagPane – test that the new tag is loaded and displayed
    • Instantiate LiveViewPane – test the duration totals
    Demo of the automation tests – explanation of the test class. Tempo Project
  • Questions
  • http://seleniumhq.org/ http://patrickwilsonwelsh.com http://www.muranosoft.com/Outsourcingblog/How-To-Use-JQuery-Instead-Of-XPath-Locators-In-Selenium-Testing-Framework.aspx http://code.google.com/p/learning-codebases/source/browse/trunk/selenium-rc-patterns/ http://www.slideshare.net/dampy/selenium-204802 http://www.developerit.com/en/search/selenium-rc http://stackoverflow.com/questions/1464606/selenium-rc-having-problems-with-xpath-for-a-table References