Test Automation for Packaged Systems: Yes, You Can!

50
W15 Test Automation 5/1/2013 3:00:00 PM Test Automation for Packaged Systems: Yes, You Can! Presented by: Chris Bushell ThoughtWorks Brought to you by: 340 Corporate Way, Suite 300, Orange Park, FL 32073 888-268-8770 ∙ 904-278-0524 ∙ [email protected] www.sqe.com
  • date post

    17-Oct-2014
  • Category

    Technology

  • view

    315
  • download

    1

description

Today, most businesses are heavily dependent on packaged systems, sometimes called commercial off-the-shelf software, for large parts of their operation. Highly-customizable packages such as BMC’s Remedy, Oracle's Maxim, and many others run the show at many of the world’s largest companies. While offering many features and feature options, these packages provide rich software development environments and a “configuration” that is a highly complex programming exercise. Chris Bushell explores why packaged systems, which are just as vulnerable to defects as custom-developed software, have been missing out on the many benefits of early automated testing. Chris argues that it's time for a change. Drawing from hands-on experience working with customized packaged systems, Chris explains that these packages offer ease of customization over testability and offers information on overcoming their limitations. Take away tips to reduce defects, lower testing costs, and improve time to market with your company’s packaged systems.

Transcript of Test Automation for Packaged Systems: Yes, You Can!

Page 1: Test Automation for Packaged Systems: Yes, You Can!

W15 Test Automation

5/1/2013 3:00:00 PM

Test Automation for Packaged

Systems: Yes, You Can!

Presented by:

Chris Bushell

ThoughtWorks

Brought to you by:

340 Corporate Way, Suite 300, Orange Park, FL 32073

888-268-8770 ∙ 904-278-0524 ∙ [email protected] ∙ www.sqe.com

Page 2: Test Automation for Packaged Systems: Yes, You Can!

Chris Bushell

A lead consultant at ThoughtWorks, Chris Bushell has a wide variety of roles including software developer, architect, test automation specialist, agile coach, and trainer. Chris has more than ten years of industry experience working in finance, retail, telecoms, and mobile in the U.K., Australia, and the U.S. Passionate about software development process and technology, he is an advocate of using open source software for building simple solutions to complex problems. Chris is an active member of the local software development community wherever he's based. Contact Chris on Twitter @chrisbushelloz, by email at [email protected], or converse with him face-to-face.

Page 3: Test Automation for Packaged Systems: Yes, You Can!

Test  Automa+on  For  Packaged  Systems:Yes  You  Can!Chris  BushellLead  Consultant,  ThoughtWorks

Page 4: Test Automation for Packaged Systems: Yes, You Can!
Page 5: Test Automation for Packaged Systems: Yes, You Can!
Page 6: Test Automation for Packaged Systems: Yes, You Can!

What  I  do

• Developer/Tech  Lead/Architect/Agile  coach

• Custom  so8ware  development

• Focus  on  building  the  right  thing

• Focus  on  high  quality

• Test  driven

Page 7: Test Automation for Packaged Systems: Yes, You Can!

How  I  do  it  –  TDD/BDD

Page 8: Test Automation for Packaged Systems: Yes, You Can!

How  I  do  it  –  Revision  Control

Page 9: Test Automation for Packaged Systems: Yes, You Can!

How  I  do  it  –  Con+nuous  Integra+on

Page 10: Test Automation for Packaged Systems: Yes, You Can!

How  I  do  it  –  Open  Source

JUnit• Light-­‐weight,  powerful

• Extensible

• Excellent  community

• Examples:  xUnit,  Selenium/WebDriver,  RSpec,  Concordion,  Cucumber  etc.

Page 11: Test Automation for Packaged Systems: Yes, You Can!

November  2011

Page 12: Test Automation for Packaged Systems: Yes, You Can!

In  the  beginning....

Page 13: Test Automation for Packaged Systems: Yes, You Can!

The  COTS  Con!

Highly extensible software “configured” in powerful

development environments, comparable in complexity, and

susceptibility to defects as anything in the custom software

development world

Page 14: Test Automation for Packaged Systems: Yes, You Can!

The  land  that  +me  forgot

Page 15: Test Automation for Packaged Systems: Yes, You Can!

Complete  lack  of  test  automa+on

“Computers  are  designed  to  do  simple  repeKKve  tasks.  The  second  you  have  humans  doing  repeKKve  tasks,  all  the  computers  get  together  late  at  night  and  laugh  at  you”

“Every  Kme  you  do  something  for  the  third  Kme,  automate  it.  You’ll  be  doing  it  a  million  Kmes”

-­‐  Neal  Ford

Page 16: Test Automation for Packaged Systems: Yes, You Can!

Surely  someone  must  be  doing  this  already?

• Commercial  tools  exist,  but  tend  to  be  a  poor  fit  for  Agile  environments-­‐ TesKng  viewed  as  a  luxury  (an  add-­‐on)

-­‐ Available  to  few  ($$$$  licensing)-­‐ Discourages  collecKve  ownership

-­‐ Difficult  to  use  good  engineering  pracKces

-­‐ Difficult  to  integrate  with  ConKnuous  IntegraKon  process  (lack  of  scriptability/headless  mode)

Page 17: Test Automation for Packaged Systems: Yes, You Can!

Lessons  learned  -­‐  what  worked  and  what  didn’t

Page 18: Test Automation for Packaged Systems: Yes, You Can!

Oracle  Siebel  CRM

Page 19: Test Automation for Packaged Systems: Yes, You Can!

But  first,  browser  automa+on  basics

• HTML  +  DOM

• Selectors-­‐  Id,  class,  xpath

• AutomaKon  API-­‐ e.g.  Selenium,  WebDriver,  Sahi,  WaKr  etc.

Page 20: Test Automation for Packaged Systems: Yes, You Can!

Our  biggest  problem

• AcKveX

• <object>

• Impervious  to  tradiKonal  automaKon  toolset

Page 21: Test Automation for Packaged Systems: Yes, You Can!

All  is  not  lost

• Not  all  parts  of  the  applicaKon  used  AcKveX

• Some  controls  were  regular  HTML  (albeit  machine  generated)-­‐ WebDriver

• Perhaps  we  could  use  some  kind  of  hybrid  approach  to  test  automaKon?-­‐ WebDriver  +  X,  Y  or  Z?

Page 22: Test Automation for Packaged Systems: Yes, You Can!

Introducing  Sikuli  -­‐  automa+on  using  images

Page 23: Test Automation for Packaged Systems: Yes, You Can!

An  example  using  Google

Page 24: Test Automation for Packaged Systems: Yes, You Can!

package com.tw.xconf;

import org.sikuli.script.FindFailed;import org.sikuli.script.Screen;import org.sikuli.script.Settings;

public class Demo {

public static void main(String[] args) { Screen screen = new Screen(); try { screen.click("images/criteria.png"); screen.type("ThoughtWorks"); screen.click("images/search.png"); } catch (FindFailed e) { e.printStackTrace(); } }}

Page 25: Test Automation for Packaged Systems: Yes, You Can!

Drawbacks  of  Sikuli

• Difficult  to  manage  large  numbers  of  images

• Can  be  confused  when  different  regions  of  the  screen  look  the  same

• Tests  easily  broken  by  small  changes  in  the  UI

• ComparaKvely  slow  to  execute

 

Page 26: Test Automation for Packaged Systems: Yes, You Can!

The  story  so  far....

• Ability  to  automate  the  UI

-­‐ WebDriver  for  the  regular  HTML

-­‐ Sikuli  for  the  AcKveX  controls

Page 27: Test Automation for Packaged Systems: Yes, You Can!

The  last  hurdle

• How  do  we  extract  values  from  the  page  so  we  can  perform  asserKons  on  them?

Page 28: Test Automation for Packaged Systems: Yes, You Can!

Tried  but  failed

• OpKcal  Character  RecogniKon  (OCR)-­‐ Tesseract

• White

• AutoIt

• Win32-­‐Autogui

Page 29: Test Automation for Packaged Systems: Yes, You Can!

Plan  B

•  Oracle  ApplicaKon  TesKng  Suite  (OATS)

-­‐ Record  +  playback

-­‐ Proprietary  test  automaKon  API

Page 30: Test Automation for Packaged Systems: Yes, You Can!

Test  automa+on  is  soYware  development

• Code  duplicaKon  is  bad,  resulKng  in  fragile  test  suites

-­‐ Small  changes  can  break  many  tests  which  requires  significant  maintenance

-­‐ Frequently  see  test  automaKon  abandoned  as  a  result  of  this

• Record  +  playback  tools  make  it  difficult  to  introduce  abstracKons  to  remove  duplicaKon

Page 31: Test Automation for Packaged Systems: Yes, You Can!

Oracle  Applica+on  Tes+ng  Suite

• A  process  of  learning  through  experimentaKon

• Generates  Java  code  under  the  covers  (for  both  Seibel  and  HTML  automaKon)-­‐ Liberate  the  API  from  tooling

• Creates  executable  JWG  files  as  test  arKfacts-­‐ Understand  the  format  of  these  files  so  we  can  create  them  programmaKcally

Page 32: Test Automation for Packaged Systems: Yes, You Can!

Gains

•  Ability  to  more  easily  use  good  programming  pracKces  (abstracKons,  code  refactoring  etc)

• Ability  to  integrate  test  arKfacts  with  ConKnuous  IntegraKon  process

• A  maintainable  test  suite  for  an  Agile  team

Page 33: Test Automation for Packaged Systems: Yes, You Can!
Page 34: Test Automation for Packaged Systems: Yes, You Can!

Remedy  +cket  management  system

Page 35: Test Automation for Packaged Systems: Yes, You Can!

Great  news!

• A  more  tradiKonal  webapp  (albeit  with  many  quirks)

• AutomaKon  possible  with  familiar  toolset  (WebDriver,  in  our  case)  

Page 36: Test Automation for Packaged Systems: Yes, You Can!

Example  quirk  #1:  windows

Page 37: Test Automation for Packaged Systems: Yes, You Can!

Solu+on:  model  the  windows  a  stack

• WindowManagingWebDriver

• Allowed  us  to  keep  tests  focused

• Also  responsible  for  maximizing  browser  windows  (quirk  1.1)

Page 38: Test Automation for Packaged Systems: Yes, You Can!

Example  quirk  #2:  mouse  ac+ons  alone  not  enough

               public  void  navigateToRelationshipsTab()  {          findElement(RELATIONSHIPS).sendKeys(Keys.ENTER);          findElement(RELATIONSHIPS).click();        }

Page 39: Test Automation for Packaged Systems: Yes, You Can!

The  importance  of  abstrac+ons

• Page  model

• Domain  objects  e.g.  Incident

• Builders  for  domain  objects

• Page  level  gekers/sekers  e.g.  IncidentSeker,  IncidentGeker

• Workflows  to  model  sequences  of  interacKons

Page 40: Test Automation for Packaged Systems: Yes, You Can!

Data  management

Page 41: Test Automation for Packaged Systems: Yes, You Can!

Data  management

Page 42: Test Automation for Packaged Systems: Yes, You Can!

Solu+on:  APIs  (again)

• AcKon  Request  System  (ARS)  API  allows  creaKon  of  state  e.g.  Incidents  programmaKcally

• Simple  key/value  interface

• Gave  us  the  ability  to  replace  the  use  of  some  of  our  Workflows  with  faster  running  API  based  Workflows

• Objects  created  by  API  based  workflows  could  be  looked  up  in  the  browser

Page 43: Test Automation for Packaged Systems: Yes, You Can!

The  story  so  far....

• Ability  to  automate  the  UI  using  WebDriver

• AbstracKons  in  place  for  robust  tesKng

• Ability  to  setup  state  using  fast  API

• Growing  regression  test  suite

Page 44: Test Automation for Packaged Systems: Yes, You Can!

Reverse  Con+nuous  Integra+on

Page 45: Test Automation for Packaged Systems: Yes, You Can!

Summary

• COTS  test  automaKon  is  possible!-­‐ Be  prepared  to  find  challenges/quirks  along  the  way

• ConKnuous  IntegraKon  is  possible

• APIs  are  your  friends  -­‐  seek  them  out

• AbstracKons  are  crucial,  especially  with  machine  generated  code  and  environmental  differences

Page 46: Test Automation for Packaged Systems: Yes, You Can!

Ques+ons

Page 47: Test Automation for Packaged Systems: Yes, You Can!

Email:  [email protected]`er:  @chrisbushelloz

Github:  www.github.com/cbushellMy  talks:  www.speakerdeck.com/cbushellLinkedIn:  www.linkedin.com/in/chrisbushell

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

315 Montgomery Street, 16th Floor San Francisco, California 94104T: +1 415 273 1389 C: +1 415 568 8186 F: +1 415 986 2964E: [email protected]

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Chris BushellLead Consultant

Page 48: Test Automation for Packaged Systems: Yes, You Can!

Credits

• Ross  Macbeth,  J3474  :  Old  night  safe,  Belfast,  licensed  under  CreaKve  Commons,  hkp://www.geograph.ie/photo/2261863

• Alan  Chia,  A pile of Lego blocks, of assorted colours and sizes, licensed  under  CreaKve  Commons,  hkp://en.wikipedia.org/wiki/File:Lego_Color_Bricks.jpg

Page 49: Test Automation for Packaged Systems: Yes, You Can!
Page 50: Test Automation for Packaged Systems: Yes, You Can!