• No results found

Software Automated Testing

N/A
N/A
Protected

Academic year: 2021

Share "Software Automated Testing"

Copied!
37
0
0

Loading.... (view fulltext now)

Full text

(1)

Software Automated Testing

Keyword Data Driven Framework Selenium Robot

Best Practices

(2)

Agenda

²  Automation Engineering Introduction ²  Keyword Data Driven

²   How  to  build  a  Test  Automa7on  Framework   ²  Selenium Introduction

²  Robot Framework and Demo

²  Test Automation Best Practices ²  Q/A

(3)

Automation Engineering

§  What is Automated Testing

•  use  of  special  so,ware  to  control  the  test  

execu3on  and  the  comparison  of  actual  outcomes   to  predicted  outcomes.    

•  Test  automa3on  can  automate  some  repe33ve  

but  necessary  tasks  in  a  formalized  tes3ng  process   already  in  place,  or  add  addi3onal  tes3ng  that  

would  be  difficult  to  perform  manually  

(4)

Benefit of Test Automation

§  More reliable §  Repeatable

§  Less time consuming §  Less boring

§  Unattended Test Execution

§  Execute tests could not be done by human §  Less expensive

(5)

GUI Test Automation

§  Test Scripts §  GUI Objects

(6)

GUI object 1 Logical Name { Physical descriptions } ……… GUI object n:

TSL 1 (GUI Object, other parameters); ……….. TSL n (GUI Object, other parameters);

Controls/Objects

GUI Repositories AUT

(7)

Command Interactive Test

Automation

§  Test requires interactive steps §  Via console, CLI

§  Use command language: TCL, Expect, Perl, Unix shell…

(8)

What should Automate?

§  Regression tests

§  Test for stable applications/features §  Repetitive tests

§  Acceptance test (positive test) §  Boundary & capacity tests

§  Sanity & spot tests

(9)

What should NOT automate

§  Usability testing

•  "How  easy  is  the  applica7on  to  use?"   §  One-time testing

§  "ASAP" testing

•  "We  need  to  test  NOW!"  

§  Ad hoc/random testing

•  based  on  intui7on  and  knowledge  of  applica7on   §  Tests without predictable results

(10)

Test Automation Process

§  Creating Tests

•   Create  tests  using  both  recording  and  programming  

•   Insert  checkpoints  where  is  wanted  to  check  the  behavior   of  the  applica7on  being  tested  

§  Running Tests

•   Emulate  users  to  interact  to  AUT  

•   Compares  the  current  response  of  AUT  to  its  expected   result  

§  Analyzing Test Results

•   Examine  the  test  results    

•   Test  results:  major  events  that  occurred  during  the  run   tests    

(11)

Automated Testing Methodology

§  Record/Playback Method

•   Tes7ng  Tool  records  keystrokes,  mouse  ac7ons,  verifica7on  lists,  etc.  and   playback  then  

§  Functional Decomposition Method

•   The  Applica7on  is  broken  down  into  Business  Func7ons      

•   Automated  Scripts  are  developed  using  the  Test  Script  to  perform  those   func7ons    

•   Data-­‐Driven  Process  using  Input  &  Verifica7on  Data  Files    

§  Test-Plan Driven Method

•  The  Test  Cases  are  broken  down  into  'generic'  tes7ng  ac7ons    

•   Scripts  are  developed  using  the  test  scripts  to  perform  these  'generic'  ac7ons     •   Input  File  controls  the  processing  as  well  as  providing  the  Input  and  

Verifica7on  data    

(12)

Record/Playback

§  Advantages

•   Easy  to  Use      

•   Tester  just  starts  recording  and  executes  the  Manual  Test  Case  

§  Disadvantages

•   Reliability  

•   The  tester  can  make  errors,  which  are  then  recorded,  and  have  to  be   corrected    

•   Failure  on  replay  due  to  7ming  issues    

•   Failure  on  replay  due  to  events  that  occur  that  were  not  recorded   (pop-­‐ups,  messages,  etc.)        

•   Maintenance    

•   Scripts  contain  hard-­‐coded  data  that  must  be  updated  if  the   Applica7on  or  the  Data  changes    

•   Scripts  must  be  enhanced  or  corrected  aYer  recording    

•   Scripts  &  verifica7on  need  to  be  re-­‐recorded  if  the  Applica7on   processing  changes    

(13)

Functional Decomposition

§  Maintenance

•   Modular  design:  If  a  Business  Func7on  changes,  only  a   few  scripts  must  be  modified  

•   Complex  Test  Cases  can  be  constructed  by  calling  Business   Func7on  Scripts  from  a  Main  Rou7ne  

•   Data-­‐Driven:  Script  can  be  used  for  many  Test  Cases  by   using  different  input/verifica7on  files        

§  Reliability

•   Tester  error  is  eliminated,  as  is  "scripter  error"  aYer  the   script  has  been  properly  coded  and  tested  

•   Unexpected  events  (pop-­‐ups,  messages,  etc.)  can  be   an7cipated  and  coded  for            

(14)

Functional Decomposition

§  Maintenance

•   Each  Business  Func7on  requires  a  script.    There   may  be  hundreds  of  Business  Func7ons    

•   Changes  in  Test  Cases  require  updates  to  several   sets  of  input/verifica7on  files  for  each  Test  Case     •   Format  of  input/verifica7on  records  must  be  

strictly  adhered  to  or  the  tests  will  fail    

•   Testers  must  maintain  the  input/verifica7on   records  as  well  as  the  Test  Case  documenta7on  

(15)

Keyword Data Driven

§  A proven methodology which applied SUCCESSFULLY in Software Automated Testing

§  Action-based Testing

§  Test scripts vs test cases

§  Automation Test Engineer vs Developer in Test

(16)
(17)

How To Build

Driver

Controller

Test Modules/Test cases Test Plan/Test Modules

Read Read . . . Libraries/Functions Call Reports Return Call Write “KEYWORDS”

Test Modules/Test cases Test Modules/Test cases

Test Modules/Test cases

(18)

Test Cases

(19)

Selenium Introduction

§  Selenium is a Functional Automation tool for Web applications.

§  Selenium is an open source tool (No cost Involved in it). §  Selenium supports the languages like HTML, Java, PHP,

Perl, Python, Ruby and C#.

§  It supports the browsers like IE, Mozilla Firefox, Safari, Google Chrome and Opera.

§  It supports the operating systems like Windows, Linux and Mac.

§  It is very flexible when compared to QTP and other

(20)

Components

§  Selenium IDE

§  Selenium RC(Remote Control) §  Selenium Grid

(21)

SELENIUM IDE

§  IDE stands for Integrated Development Environment. §  Which is used for Record and Play back the scripts.

§  It is an Add on for Mozilla Firefox, which means we can download the Selenium IDE from Mozilla Firefox and we can Record and Run the scripts in Mozilla Firefox only. §  Selenium IDE is accountable for user actions.

§  We can Run the Recorded scripts against other browsers by using Selenium RC

(22)

Selenium RC

§  It is a Server and launches the Browser.

§  It acts as a API and Library of Selenium.

§  We need to configure the Selenium RC with the supported language, then we can

(23)

Selenium Grid

§  Selenium Grid is used for launching the multiple browsers with supported operating system in

parallel.

§  We can run the scripts on different browsers in parallel.

§  It allows you to easily run multiple tests in parallel, on multiple machines, in a

(24)

Scripting(Selenese)

§  Selenium commands, often called selenese. The set of these commands are nothing but test script.

§  If you want to write test scripts for any application, initially you need to integrate Selenium with Java by using

Eclipse. (check the Integration doc).

§  After completion of the integration, First we need to create the selenium object as below.

§  DefaultSelenium selenium=new

DefaultSelenium(“System address”, ”Port no of selenium”, “Browser to launch”, “url”).

(25)

Basic Selenese

§  Start(): To launch the Browser. §  Open(): To open the url.

§  Close(): To kill or close the Browser.

§  windowMaximize(): To maximize the window. §  Type(): To enter some text into a text box.

§  Click(): To click on Button, Radio button and Link.

§  Select(): To select a value or label from combo box or list box or Drop down.

(26)

§  Check(): To check the check box.

§  selectPopUp(): To identify the pop up window. §  selectWindow(): To identify the child window. §  selectFrame(): To identify the frame.

§  getAlert(): To Click ok on alert box.

§  getConfirmation(): To click ok on confirmation message.

§  chooseCancelOnNextConfirmation(): To click Cancel on next displayed confirmation message.

§  chooseOkOnNextConfirmation(): To click Cancel on next displayed confirmation message.

(27)

Selenium   Driver  Script   Environment   Test  Cases   Test  Results   Test  Data   AUT  

Selenium Framework

(28)
(29)

What It is

§  Python-based, keyword data-driven test automation framework for end-to-end acceptance testing

§  Open source

(30)

Features

§  Enables easy-to-use tabular syntax for creating test cases in a uniform way. §  Allows using keyword-driven, data-driven and behavior-driven (BDD) approaches. §  Provides ability to create reusable higher-level keywords from the existing keywords. §  Provides easy-to-read reports and logs in HTML format.

§  Is platform and application independent.

§  The modular architecture supports creating tests even for applications with several diverse interfaces.

§  Provides a simple library API for creating customized test libraries.

§  Provides a command line interface and XML based outputs for integration into existing build infrastructure (continuous integration systems).

§  Provides support for Selenium for web testing, Java GUI testing, running processes, Telnet, SSH, and so on.

§  Remote library interface enables distributed testing and implementing test libraries in any programming language.

§  Provides tagging to categorize and select test cases to be executed.

(31)

Integration

§  Editor: RIDE

§  Selenium Library – Web testing §  Jenkins Plug-in

§  Sikuli application – app testing §  Extended Python/Java Libraries

(32)
(33)

Keywords

§  BuiltIn keywords §  Library keywords

•  All  lowest  level  keywords  are  defined  in  test  libraries  which  are   implemented  using  standard  programming  languages.    

•  Opera3ngSystem  Lib:  to  support  common  opera3ng  system  func3ons  

•  SeleniumLibrary  :  Web  tes3ng  

•   Screenshot  library:  taking  screenshots  

§  User-defined keywords

•  WHEN:  no  suitable  library  available  

•  Create  new  higher-­‐level  keywords  from  other  keywords  

(34)
(35)

Demo

h^p://robo_ramework.org/  

(36)
(37)

§  Eliminate “Record/Playback hard-coding” §  Apply coding guidelines

§  Exception handling §  Batch Test

§  Re-usable & portable §  Customized reporting §  Memory leaks

§  Dynamic GUI load §  Wise loop

§  Remote Controlling Test Execution §  Progress Testing Status

References

Related documents

following merging this results in smaller AVM-D-generated test suites on average for STICCER-HGS compared to the original STICCER (631 test cases as opposed to 646), but

In particular, we present the techniques of test-input generation based on a wrapper mechanism, which enables us to leverage the existing Java test- generation tools to generate

BALLISTA SERVER TEST REPORTING TEST SELECTION RESULT PATTERN DISCOVERY INTERFACE SPECIFICATION CAPTURE TESTING OBJECT COMPILER USER’S COMPUTER BALLISTA TEST CLIENT MODULE UNDER TEST

HP Business Process Testing enables non-technical subject matter experts to build, data-drive, execute and document test automation without any programming knowledge, allowing them

The some of the automated software testing tools are WinRunner, LoadRunner, Quick Test Professional, OpenSTA, Test Director, SilkTest, Rational Robot, Silk Performer, Astra

The method is presented by: UML-based test model description, rules and prin- ciples for its construction, generation of executable test scripts including graph traverse

Keyword-driven frameworks are based on the concept of separating not only test data but also keywords. Keywords are translated into actions using an automation driver.

We presented three classes of test- ing services: TaaS D for developers to more thoroughly test their code, TaaS H for end users to check the software they install, and TaaS