introduction to ui testing with swat
Download
Skip this Video
Download Presentation
Introduction to UI testing with SWAT

Loading in 2 Seconds...

play fullscreen
1 / 31

Introduction to UI testing with SWAT - PowerPoint PPT Presentation


  • 113 Views
  • Uploaded on

Introduction to UI testing with SWAT. 2/12/2011. Ultimate Software.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Introduction to UI testing with SWAT' - efuru


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
ultimate software
Ultimate Software

Ultimate isa leading provider of unified human capital management SaaS solutions for global businesses. Its award-winning UltiPro® includes recruitment, onboarding, benefits management, payroll, performance and learning management, reporting, self-service, and more.

about ultimate software
About Ultimate Software
  • Founded in 1990
  • Dedicated focus on HR, payroll, benefits, talent management
  • Award-winning UltiPro® product and customer services
  • 1100 employees
  • 250 people in development
  • 15 large kanban teams
  • .NET, MSSQL, Delphi shop
  • Headquarters in Weston, FL
full time and internship positions
Full-time and Internship positions

Email Resumes or Connect on LinkedIN:

[email protected]

Best Mid-Size Company to Work for in America 2008 & 2009

who am i
Who Am I???
  • Michael Longin – Ultimate Software
    • Lead Process Engineer \ Software Engineer
    • Certified Scrum Master
    • Project Lead - SWAT
goals for this session
Goals for this session
  • Attendees should be able to create and update UI tests
syllabus
Syllabus
  • Why Test Through the UI
  • Introduction to SWAT
  • Running tests against different browsers (IE\Firefox\Chrome)
  • Navigating
  • Bread and Butter Commands
  • The concept of expressions
  • Variables
  • Command Modifiers
  • Macros
  • SWAT Editor
  • Where to get help
  • Questions?
an introduction to swat
An Introduction to SWAT
  • SWAT
    • Simple Web Automation Toolkit
    • Meant to provide a simple way to test the UI of a website
    • C# Library
  • Library of commands
    • UI
    • Database
  • Not tied to the included editor, fitnesse, or any other runner
  • Open Source
    • Anyone can download the program and the source
browsers
Browsers
  • Currently Supported Browsers
    • IE
    • Firefox
    • Chrome
    • Safari on OSX
choosing a browser in a test
Choosing a browser in a test
  • C#

var _browser = new WebBrowser(BrowserType.InternetExplorer) 

or

var _browser = new WebBrowser(BrowserType.FireFox)

  • Editor \ Fitnesse
    • First line of the test

!|InternetExplorerSWATFixture|

or

!|FireFoxSWATFixture|

    • SHOULD ONLY BE IN A TEST ONCE!!!
how commands are entered fitnesse editor
How commands are entered (fitnesse\editor)
  • All test blocks start with !|SWATFixture|
  • Commands come underneath
  • Example:

!|SWATFixture|

|OpenBrowser|

|NavigateBrowser|www.google.com|

navigation
Navigation
  • Open Browser
    • |OpenBrowser|
    • _browser.OpenBrowser()
  • Navigate Browser
    • Syntax
      • |NavigateBrowser|url|
      • _browser.NavigateBrowser(string url)
    • Example
      • |NavigateBrowser|www.google.com|
navigation continued
Navigation continued
  • Attach to Window
    • Used to attach to an open browser or popup
    • Does not need to be exact
    • |AttachToWindow|WindowTitle|
    • _browser.AttachToWindow(string windowTitle)
  • Close Browser
    • |CloseBrowser|
    • _browser.CloseBrowser()
where we are now
Where we are now
  • C#

var _browser = new WebBrowser(BrowserType.InternetExplorer) 

_browser.OpenBrowser();

_browser.NavigateBrowser(“www.google.com”);

_browser.CloseBrowser();

  • Editor \ Fitnesse

!|InternetExplorerSWATFixture|

!|SWATFixture|

|OpenBrowser|

|NavigateBrowser|www.google.com|

|CloseBrowser|

standard command parameters
Standard command parameters
  • Identifier Type
    • http://ulti-swat.wikispaces.com/QS_Fitnesse_IdentifierTypes
    • ID
    • Name
    • InnerHTML
    • Expression (we will get to this one in a moment)
  • Identifier
    • Example <label id=“myID”>my label</label>
    • |id|myID|
    • |InnerHTML|my label|
    • NOTE* when using an identifier other then Expression must be exact
  • Tagname
    • Optional
    • Speeds up tests
    • Recommended
bread and butter commands
Bread and Butter commands
  • Checking for an item on the page
    • AssertElementExists
    • Used to determine if an element is on the screen
    • |AssertElementExists|IdentifierType|identifier| tagName(optional)|
  • Setting the value of an attribute
    • SetElementAttribute
    • Could be used to set a textbox
    • |SetElementAttribute|IdentifierType|identifier|attributeName|attributeValue|tagName(optional)|
    • Attribute
      • The Attribute that will be set
      • Could be value, class, style, etc
    • Attribute Value
      • Value you want to set it to
bread and butter continued
Bread and Butter continued
  • Firing an attributes events
    • StimulateElement
    • Could be used to click a button or change a drop down
    • |StimulateElement|IdentifierType|identifier|eventName| tagName(optional)|
    • EventName
      • Onclick, OnChange, OnBlur, etc
where we are now c
Where we are now (C#)

var _browser = new WebBrowser(BrowserType.InternetExplorer) 

_browser.OpenBrowser();

_browser.NavigateBrowser("www.google.com");

_browser.SetElementAttribute(IdentifierType.Name, "q", AttributeType.Custom, "value", "South Florida Code Camp", "INPUT");

_browser.StimulateElement(IdentifierType.Name, "btnG", "onclick", "INPUT");

_browser.CloseBrowser();

where we are now fitnesse editor
Where we are now (Fitnesse \ Editor)

!|InternetExplorerSWATFixture|

!|SWATFixture|

|OpenBrowser|

|NavigateBrowser|www.google.com|

!|SWATFixture|

|SetElementAttribute|name|q|value|UltimateSoftware|input|

|StimulateElement|name|btnG|onclick|input|

!|SWATFixture|

|CloseBrowser|

expressions
Expressions
  • Allow more powerful searches
  • http://ulti-swat.wikispaces.com/Expressions+Explained
  • Can string together multiple attributes
  • : vs =
    • : means contains
    • = means exact
  • ‘;’ used to break up attributes
  • Example
    • <label id=“myId”>my label</label>
    • Expression|id=myID;innerHTML:my lab|
  • Uses regular expressions
  • NOTE*
    • Period ‘.’ is a wild card, can mean anything
expressions continued
Expressions continued
  • Matchcount
    • Check for multiple instances
    • Example: innerHTML#2:ulti
      • Reads as, “ulti” must be contained twice in the HTML
  • ParentElement
    • Can use the parent element
    • Example parentElement.id:pid;class:hide
      • <tr id=“pid”><td class=“hide”></td></tr>
variables fitnesse editor
Variables (Fitnesse \ Editor)
  • Can be used as part of an expression or as an identifier
  • Design time
    • Used to create a variable when your writing the tests
    • When to use
      • When something is likely to change
      • When something is repeated often
    • To Set
      • !define loginUserName (atnipj)
    • To Use
      • ${loginUserName}
      • Expression|id:${myID}
  • Run Time
    • Variables that are populated when running the test
    • When to use
      • When a variable is needed that can only be set at the time of running
    • To Set
      • |GetElementAttribute|IdentifierType|identifier|attributeName|YourVariableName|tagName|
    • To Use
      • >>YourVariableName<<
      • Expression|id:>>myID<<
macros fitnesse editor
Macros (Fitnesse \ Editor)
  • In C# would be known as methods
  • Very powerful
  • In fitnesse each test can be used in any other test
  • Macros can take in variables
  • Reasons to use
    • Make tests less brittle
      • Any time an action is done in multiple tests, if the action changes can break all the tests
        • Example: log in
    • Make tests more readable
      • Can turn 5-30 lines of code into a single readable line
        • Example : login macro
    • Make tests more easily updatable
      • Turn the InternetExplorerSWATFixture line into a macro
        • Changing this to Firefox will update all tests to run in firefox
  • How to call a macro
    • !include .SwatMacros.Login
  • Macros are VERY Important and Useful
slide26
SQL
  • SWAT has a host of SQL functions built in
  • Connecting to a SQL Server

!|SWATFixture|

|ConnectToMssql|dbServer|username|password|

|SetDatabase|dbName|

sql commands
SQL Commands
  • SetQuery
    • Used to run a query against the sql server
    • Results are stored in memory
  • Assert Record Count
    • Verifys how many rows were returned against an expected result
    • |AssertRecordCount|ExpectedNumber|
  • AssertRecordValuesByColumnName
    • Used to verify values in the database
    • |AssertRecordValuesByColumnName|[RowIndex]|ColumnName|ExpectedValue|
  • GetDbRecordByColumnName
    • Used to place the value of a sql check into a variable
    • |GetDbRecordByColumnName|VariableName|[RowIndex]|ColumnName|
  • Others available
swat editor
SWAT Editor
  • Included in SWAT download from sourceforge
  • Up to date walk-throughs here:
    • http://ulti-swat.wikispaces.com/QS_SwatEditor
  • Tests can be run\written in the editor
  • SQL query editor
    • Included Database query editor allows you to create Select, Update, Insert, and Delete commands
  • UI recorder is contained in the editor
final words
Final Words
  • UI tests should be a part of your test plan, but not the only part
  • Recorders are meant to help and be training wheels. They are not meant to do all the work
  • When using Fitnesse as a runner, open it in a browser (IE, Firefox, etc) that is NOT the one you will be running tests against
  • In order to use SWAT to test in Internet Explorer using C# the Apartment State has to be set to STA(Single Threaded Apartment)
where to get help
Where to get help
  • Questions
    • https://sourceforge.net/projects/ulti-swat/
    • Open forum on sourceforge
  • Websites
    • http://ulti-swat.wikispaces.com/
    • http://devxero.wordpress.com/
  • Email
questions
Questions?
  • Thank you for your attention
ad