®
Rapise Way to Rapid Web UI Test Automation
Denis Markovtsev
@dmarkovtsev
®
2 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Web UI Test Automation Challenges
▪ Cross-browser recording/playback
▪ Data loading delays
▪DOM element identification
▪Resilient XPath generation
®
3 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Test Engineers Want It Automated
▪ Recorded test should work
▪ Just after recording
▪ When included into a test suite
▪ If AUT is modified
®
4 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Typical Test Scenario
®
5 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Typical Situation
®
6 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Or Even Worse
®
7 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Reason #1: Dynamic ID
//button[@id='89EF7']/span
More examples:
<button type="button"
id="CustFreeInvoice_3_AccountingActionsTab_btn">
<div id="appGridQueryFilter_Component8738712>
®
8 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Reason #2: Weak Attribute Usage
//form[@id='aspnetForm']/div[2]/div/div/nav/div[
2]/div/div/div[2]/div/div/div/div/div/div/div/di
v/div/div/div/div/button/span/span
Compare with
//button[@role='menuitem']/span[@aria-
label='Customers']
®
9 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Reason #3: Hidden Layers
®
10 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Reason #3: Hidden Layers
Recorded:
//form[@id='aspnetForm']
Ways to fix:
//form[@controlname='Business Manager Role
Center’]
/div[contains(concat(' ', @class, ' '), ' spa-
view ') and position()=last()]/form
®
11 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Give Them Tools! To
▪ Detect dynamic IDs
▪ Analyze identification power of attributes
▪ Analyze classes
▪ Identify Anchors
®
12 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Get Unique Sorted Attribute Values
®
13 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Query and Compare Multiple Documents
®
14 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Calculate Identification Power of Attributes
®
15 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Define Anchors
//div[contains(concat(' ', @class, ' '), ' spa-
view ') and position()=last()]
Find nearest anchor to recorded element and include it in
XPath:
//div[contains(concat(' ', @class, ' '), ' spa-
view ') and position()=last()]
//button[@role='menuitem']/span[@aria-
label='Customers']
®
16 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Build Web Application Profile
®
17 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Get A Working Test After Recording
®
18 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Summary
▪ Testers need reliable recording
▪ They need tools for application analysis
▪ With proper tools they can build an application profile
▪ The profile can be used for automatic generation of
resilient Xpath expressions
®
19 | 6/30/2018 © Copyright 2006-2018 Inflectra Corporation
Thank you
Contacts:
denis@inflectra.com
dmarkovtsev
Inflectra
inflectra.com/ideas

Rapid Web UI Test Automation with Rapise

  • 1.
    ® Rapise Way toRapid Web UI Test Automation Denis Markovtsev @dmarkovtsev
  • 2.
    ® 2 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Web UI Test Automation Challenges ▪ Cross-browser recording/playback ▪ Data loading delays ▪DOM element identification ▪Resilient XPath generation
  • 3.
    ® 3 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Test Engineers Want It Automated ▪ Recorded test should work ▪ Just after recording ▪ When included into a test suite ▪ If AUT is modified
  • 4.
    ® 4 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Typical Test Scenario
  • 5.
    ® 5 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Typical Situation
  • 6.
    ® 6 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Or Even Worse
  • 7.
    ® 7 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Reason #1: Dynamic ID //button[@id='89EF7']/span More examples: <button type="button" id="CustFreeInvoice_3_AccountingActionsTab_btn"> <div id="appGridQueryFilter_Component8738712>
  • 8.
    ® 8 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Reason #2: Weak Attribute Usage //form[@id='aspnetForm']/div[2]/div/div/nav/div[ 2]/div/div/div[2]/div/div/div/div/div/div/div/di v/div/div/div/div/button/span/span Compare with //button[@role='menuitem']/span[@aria- label='Customers']
  • 9.
    ® 9 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Reason #3: Hidden Layers
  • 10.
    ® 10 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Reason #3: Hidden Layers Recorded: //form[@id='aspnetForm'] Ways to fix: //form[@controlname='Business Manager Role Center’] /div[contains(concat(' ', @class, ' '), ' spa- view ') and position()=last()]/form
  • 11.
    ® 11 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Give Them Tools! To ▪ Detect dynamic IDs ▪ Analyze identification power of attributes ▪ Analyze classes ▪ Identify Anchors
  • 12.
    ® 12 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Get Unique Sorted Attribute Values
  • 13.
    ® 13 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Query and Compare Multiple Documents
  • 14.
    ® 14 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Calculate Identification Power of Attributes
  • 15.
    ® 15 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Define Anchors //div[contains(concat(' ', @class, ' '), ' spa- view ') and position()=last()] Find nearest anchor to recorded element and include it in XPath: //div[contains(concat(' ', @class, ' '), ' spa- view ') and position()=last()] //button[@role='menuitem']/span[@aria- label='Customers']
  • 16.
    ® 16 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Build Web Application Profile
  • 17.
    ® 17 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Get A Working Test After Recording
  • 18.
    ® 18 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Summary ▪ Testers need reliable recording ▪ They need tools for application analysis ▪ With proper tools they can build an application profile ▪ The profile can be used for automatic generation of resilient Xpath expressions
  • 19.
    ® 19 | 6/30/2018© Copyright 2006-2018 Inflectra Corporation Thank you Contacts: denis@inflectra.com dmarkovtsev Inflectra inflectra.com/ideas