WARSZAWQA#10.  Author: Michal Lamperski  Contact:  Find me on LinkedIn.

Slides:



Advertisements
Similar presentations
Test Automation: Coded UI Test
Advertisements

Test Automation with Selenium
Selenium Automation Testing Suite of Tools
Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
Snejina Lazarova Senior QA Engineer, Team Lead CRMTeam Dimo Mitev Senior QA Engineer, Team Lead SystemIntegrationTeam Telerik QA Academy SOAP-based Web.
® IBM Software Group © 2010 IBM Corporation What’s New in Profiling & Code Coverage RAD V8 April 21, 2011 Kathy Chan
Selenium HP Web Test Tool Training
Selenium – Testing Tool. What is Selenium? Selenium is a robust set of tools that supports rapid development of test automation for web-based applications.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
Selenium Automation Testing Suite of Tools. What is Selenium? Selenium is a robust set of tools that supports rapid development of test automation for.
Selenium Web Test Tool Training Using Ruby Language Discover the automating power of Selenium Kavin School Kavin School Presents: Presented by: Kangeyan.
Automation using Selenium Authored & Presented by : Chinmay Sathe & Amit Prabhu Cybage Software Pvt. Ltd.
UNIT-V The MVC architecture and Struts Framework.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
User Extensions, RC and Web Driver Anton Angelov QA Engineer SystemIntegrationTeam Telerik QA Academy Telerik QA Academy.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.
Val Kravets, Luis Sanchez, Allen Chung, Phillip Anderson, Leyla Norooz, Brian Ramnarian, Todd Watson.
Robot Framework – Basic Level. Date: Version:1.0 Page 1.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Unit and Functional Testing Your Flex Applications Mike Nimer Dir. Of Engineering nomee.com.
Capture and Replay Often used for regression test development –Tool used to capture interactions with the system under test. –Inputs must be captured;
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Selenium and Selenium on Rails. Agenda  Overview of Selenium Simple Selenium Tests Selenium IDE  Overview of Selenium on Rails  Problems with Selenium.
And the PageObject Design Model.  How Selenium Remote Control works  You launch a server on your test machine.  Your tests connect to that server via.
Web Automation Testing With Selenium By Rajesh Kanade.
Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Web Development 101 Presented by John Valance
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Introduction Selenium IDE is a Firefox extension that allows you to record, edit, and debug tests for HTML Easy record and playback Intelligent field selection.
Lec 18 Web with Selenium 1 CSCE 747 Fall 2013 CSCE 747 Software Testing and Quality Assurance Lecture 16 Testing Web Applications 10/23/
Mohit Anand, Software Engineer Adobe 1 Selecting GUI Automation Testing Tool for Mobile Domain.
SELENIUM By- Vivek Singh Jeena, Inderpreet Singh, Ankusha Saxena, Bhanupriya D.P, Shubham Yadav, Madhavi Aminigadda.
Selenium server By, Kartikeya Rastogi Mayur Sapre Mosheca. R
Test Automation Using Selenium Presented by: Shambo Ghosh Ankit Sachan Samapti Sinhamahapatra Akshay Kotawala.
Text Selenium server 31 – October By, Vivek Singh Jeena Inderpreet Singh Ankusha Saxena Bhanupriya D.P Shubham Yadav Madhavi Aminigadda.
Tata Consultancy Services1 WebDriver Basics Submitted By : Akhil K Gagan Deep Singh Naveenrajha H M Poornachandra Meduri Shubham Utsav Sunil Kumar G Vivek.
Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Zhuhai Test Automation Overview Ryan Li Team lead of test automation Foglight QA.
Northwest Arkansas.Net User Group Jay Smith Tyson Foods, Inc. Unit Testing nUnit, nUnitAsp, nUnitForms.
Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Arklio Studija 2007 File: / / Page 1 Automated web application testing using Selenium
Introduction of Selenium Eli Lu 2016/10/13. Outline What is selenium ? Selenium Projects Selenium Sponsors Easy to use Useful Feature & Tools Useful Links.
Web driver and its comparison Selenium RC. Selenium web driver: It's web automation testing out framework that assists to execute assessments throughout.
Introduction to.
Integrating ArcSight with Enterprise Ticketing Systems
Integrating ArcSight with Enterprise Ticketing Systems
Selenium HP Web Test Tool Training
The Zen of UI Test Automation
Selenium and Selenium on Rails
JRA2: Acceptance Testing senarious
Automating GUI testing with Selenium WebDriver, Java and Eclipse
Why Selenide? Andrew Boyd.
Testing Your Alfresco Add-ons
CSCE 747 Software Testing and Quality Assurance
Onlineitguru Selenium is one of the most widely used open-source tool that is used for testing software or Automation. It is licensed under Apache License.
Atit Leelasuksan Rungroj Maipradit
What is selenium? Selenium is a portable software-testing framework for web applications. Selenium provides a playback (formerly also recording) tool.
Haden Jackson-Robbins
Selenium Web Test Tool Training Using Ruby Language
Selenium Tutorials Cheyat Training.
Automated browser testing with Selenium and C#
Web Application Development Using PHP
Presentation transcript:

WARSZAWQA#10

 Author: Michal Lamperski  Contact:  Find me on LinkedIn

Agenda: 1. Why UI Tests? 2. Selenium / Webdriver intro 3. Main methods, Locators, Waits 4. Nunit 5. Page Object Pattern 6. Continuous Integration – Teamcity 7. Additional links 8. Sources 9. Q&A

1. Why to automate? Test automation has specific advantages for improving the long-term efficiency of a software team’s testing processes. Test automation supports:  Frequent regression testing  Rapid feedback to developers  Virtually unlimited iterations of test case execution  Support for Agile and extreme development methodologies  Disciplined documentation of test cases  Customized defect reporting  Finding defects missed by manual testing

Why not to automate? It is not always advantageous to automate test cases. There are times when manual testing may be more appropriate. For instance, if the application’s user interface will change considerably in the near future, then any automation might need to be rewritten anyway. Also, sometimes there simply is not enough time to build test automation. For the short term, manual testing may be more effective. If an application has a very tight deadline, there is currently no test automation available, and it’s imperative that the testing get done within that time frame, then manual testing is the best solution.

Test Pyramid

Hump of pain

Language Universal rule: For tests use language used in application.  C#  Java  Python ...  If Angular used-> Protractor

2. Selenium – brief history  Selenium first came to life in 2004 by Jason Huggins.  He developed a Javascript library that could drive interactions with the page, allowing him to automatically rerun tests against multiple browsers.  That library eventually became Selenium Core, which underlies all the functionality of Selenium Remote Control (RC) and Selenium IDE. Selenium RC allows to control a browser from a language of your choice. ISSUESS:  Different things became impossible to do because of its Javascript based automation engine and the security limitations.  Webapps became more powerful over time making this restrictions more painful.

Selenium 1 (aka. Selenium Remote Control)  Selenium RC was the main Selenium project for a long time, before the WebDriver/Selenium merge brought up Selenium 2.  Now Selenium 1 is deprecated and is not actively supported (mostly in maintenance mode)

Selenium Remote Control Selenium RC comes in two parts. -> A server which automatically launches and kills browsers, and acts as a HTTP proxy for web requests from them. -> Client libraries for chosen language.

Selenium IDE Selenium IDE (Integrated Development Environment) is a prototyping tool for building test scripts. It is a Firefox plugin and provides an easy-to-use interface for developing automated tests. Selenium IDE has a recording feature, which records user actions as they are performed and then exports them as a reusable script in one of many programming languages that can be later executed. CONS:  Available only in Firefox  Designed only to create the prototypes of tests  No support for iteration and conditional operations  Test execution is slow compared to that of Selenium RC and WebDriver.

Selenium IDE

Selenium 2 (aka. Selenium WebDriver)  The WebDriver API is primarily intended to allow developers to write tests that automate a browser from a separate controlling process.  Selenium and WebDriver developers agreed that both tools have advantages and that merging the two projects would make a much more robust automation tool.  Selenium 2.0 supports the WebDriver API and underlying technology, along with the Selenium 1 technology underneath the WebDriver API for maximum flexibility in porting your tests. In addition, Selenium 2 still runs Selenium 1’s Selenium RC interface for backwards compatibility.

Selenium WebDriver  Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. How these direct calls are made, and the features they support depends on the browser you are using.  For those familiar with Selenium-RC, this is quite different from what you are used to. Selenium-RC worked the same way for each supported browser. It ‘injected’ javascript functions into the browser when the browser was loaded and then used its javascript to drive the AUT within the browser. WebDriver does not use this technique. Again, it drives the browser directly using the browser’s built in support for automation.

Selenium WebDriver

A different way of automating the browser. Create a browser-specific driver to control the browser directly and have to do this for each browser.  Object oriented API  Doesn’t need a real browser.  No Javascript limitations  No need for a server.  CONS ??? Maybe there are...

WE DON’T CARE !!!

Selenium Grid  Running tests in parallel: ... maybe next time.

3. Main methods Programming basics:

Main methods CloseClose the current window, quitting the browser if it is the last window currently open. Dispose Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. FindElement Finds the first IWebElement using the given method. FindElements Finds all IWebElements within the current context using the given mechanism. ManageInstructs the driver to change its settings. NavigateInstructs the driver to navigate the browser to another location. QuitQuits this driver, closing every associated window. SwitchToInstructs the driver to send future commands to a different frame or window

Main methods WebDriver: New instances with options / switches; Close(); Quit(); For Navigate(): GoToUrl(); For FindElement(): Clear(); Click(); SendKeys(); Submit(); For Manage(): SetPageLoadTimeout(); ImplicitlyWait(); SetScriptTimeout() JavaScriptExecutor ExecuteScript();

Waits  ITimeouts ImplicitlyWait(TimeSpan timeToWait); Specifies the amount of time the driver should wait when searching for an element if it is not immediately present.  ITimeouts SetPageLoadTimeout(TimeSpan timeToWait); Specifies the amount of time the driver should wait for a page to load when setting the OpenQA.Selenium.IWebDriver.Url property.  ITimeouts SetScriptTimeout(TimeSpan timeToWait); Specifies the amount of time the driver should wait when executing JavaScript asynchronously. Tip: while (true) { var ajaxIsComplete = (bool)(Driver as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0"); if (ajaxIsComplete) break; }

Locators Selenium WebDriver uses 8 locators to find the elements on web page: IId Gets a mechanism to find elements by their ID. NName Gets a mechanism to find elements by their name. LLinktext Gets a mechanism to find elements by their link text. PPartial Linktext Gets a mechanism to find elements by a partial match on their link text. TTag Name Gets a mechanism to find elements by their tag name. CClass name Gets a mechanism to find elements by their CSS class. CCssSelector Gets a mechanism to find elements by their cascading style sheet (CSS) selector. XXpath Gets a mechanism to find elements by an XPath query.

4. NUNIT  NUnit is a unit-testing framework for all.Net languages.  Initially ported from JUnit, the current production release, version 2.6, is the seventh major release of this xUnit based unit testing tool for Microsoft.NET.JUnit  Similar unit-testing framework: - SpecFlow, - MSTest, - Full list available at: rameworks rameworks

Attributes  Source:  [TestFixture] – marks a class that contains tests and, optionally, setup or teardown methods.  [SetUp] – used to provide a common set of functions that are performed just before each test method is called.  [Test] – marks a method inside a TestFixture class as a test.  [TestCase] – serves the dual purpose of marking a method with parameters as a test method and providing inline data to be used when invoking that method.  [TearDown] – used to provide a common set of functions that are performed after each test method is run.  [Catalog] - attribute provides an alternative to suites for dealing with groups of tests.  [Ignore] - an attribute to not run a test or test fixture for a period of time.

Assertions   Comparisons Assertions that perform comparisons are often your best choice because they report both expected and actual values. The expected value is always the first argument. The AreSame method tests that the same objects are referenced by both arguments. All the variants of AreEqual test for equality.  Condition Tests Methods that test a specific condition are named for the condition they test and take the value tested as their first argument and, optionally a message as the second.  Assert.IsTrue, Assert.IsFalse;  Assert.IsNull, Assert.IsNotNull;  Utility Methods The Assert.Fail method provides you with the ability to generate a failure based on tests that are not encapsulated by the other methods. It is also useful in developing your own project-specific assertions. The Assert.Ignore method provides you with the ability to dynamically cause a test or suite to be ignored at runtime. It may be called in a test, setup or fixture setup method.

5. Page Object Pattern A Page Object is a object oriented class that serves as an interface to a page of AUT (Application Under Test). If UI change, tests don’t need to be change, only the code within the page object need to be changed.  1. There is clean separation between test code and page specific code such as locators and layout.  2. There is single repository for the services or operations offered by the page rather than having these services scattered through out the tests.

Page Object Pattern  Each page is defined as it’s own class !!!  Actions (including navigation) are represented as functions for a class.  Each function returns a new Page object, signifying what page the actions stops on.  Tests only talk to the page objects.  Page objects only talk to the driver.  Elements on the page are stored as variables for the page object  Tests become a string of well defined functions, not meaningless gibberish.  Class Inheritance can be used to define functionality to a set of pages.

Page Object Example

RULES TO FOLLOW: #1: DESIGN FIRST #2: DO NOT AUTOMATE EVERYTHING #3: WRITE SHORT TESTS #4: CREATE INDEPENDENT TESTS #5: FOCUS ON READABILITY #6: TESTS MUST BE QUICK #7: TESTS RESISTANT TO CHANGE

LET’S CHECK IT ON CODE...

6. Continuos Integration Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.

Continuos Integration

HOW IT REALLY LOOKS...

7. Additional links Tools:    Tutorials:    Books:  Burns D., „Selenium 2 Testing Tools Beginner's Guide”, 2012, Packt publishing  Crispin L., Gregory J., „Agile Testing: A Practical Guide for Testers and Agile Teams”, Pearson Education,2008  

8. Sources:     d-System-Testing-for-Web-Apps-at-CFObjective d-System-Testing-for-Web-Apps-at-CFObjective  Jasiński Łukasz, „7 essential principles for automated functional tests”, WrotQA, 2014   presentation-selenium-conference ?related=1 presentation-selenium-conference ?related=1  pattern/ pattern/    

9. Q&A

Thank you for your participation!