SlideShare a Scribd company logo
1 of 32
Automation
Scripting Techniques
Zhu Zhong (@钟柱)
6/30/14
Hello, my name is Zhu Zhong (钟
柱)
12+ years, working on
automation test tools
Work(ed, ing) for
• Nortel
• Alcatel-Lucent
I like
• Write code
• Test
automation
• Drawing
• BBQ
• Ocarina
A Good Book
O 13+ years passed so far, automation scripting
techniques haven’t changed since the
publishing of this book.
O All the ideas of this slides come from my
understanding of this book plus my experience
• by Mark Fewster/ Dorothy Graham
• Published: September, 1999
What’ll We be Talking About?
O We will NOT talk about
O How to use an automation test tool
(EasyTest , QTP, Robot Framework, etc)
O Any specific testing techniques (GUI, Web,
etc)
O We will talk about
O Automation test scripts
O Types of scripts & their differences
O Which script technique to choose
Different Scripting Techniques
O Linear scripts
O Structured scripts
O Shared scripts
O Data-driven scripts
O Keyword-driven scripts
Different Scripting Techniques
O Linear scripts
O Structured scripts
O Shared scripts
O Data-driven scripts
O Keyword-driven scripts
Linear Scripts
O A Linear script is what you end up with
when you record a test case performed
manually.
(AutoIt)
Is linear scripts Good or Bad?
Linear Scripts
O Good
O Quick start automation
O Demonstration or training
O Prepare test data
O Bad
O Hard coded data into scripts
O Vulnerable to changes
O No sharing or reuse
Different Scripting Techniques
O Linear scripts
O Structured scripts
O Shared scripts
O Data-driven scripts
O Keyword-driven scripts
Structured Scripts
= Linear scripts + if + for/while loop
(scratch)
Structured Scripts
O Good
O More robust
O Reuse
O Bad
O Require programming skills
O More complex
O Test data still ‘hard-coded’ into the script
Different Scripting Techniques
O Linear scripts
O Structured scripts
O Shared scripts
O Data-driven scripts
O Keyword-driven scripts
Shared Scripts
O Shared scripts are scripts that are used (or
shared) by more than one test case.
O May be called reusable script/function library
O Hard-coded values -> variables
Shared Scripts
– an example
(EasyTest)
Convert shared script to
HOST.checkLinuxVersion
Test case is simplified: just need to call shared script HOST.checkLinuxVersion
Shared Scripts
– shared scripts/functions makes a test case
easier to read/maintain
This is a real test case we used to test EasyTest
(Squish)
Shared Scripts
O Good
O Similar tests will take less effort to
implement
O Reuse: eliminates repetitions.
O Keep the changes to a minimum
O Bad
O Hard to track/find scripts, documents,
names and store.
O Shared scripts are often specific to part of
the system under test.
Different Scripting Techniques
O Linear scripts
O Structured scripts
O Shared scripts
O Data-driven scripts
O Keyword-driven scripts
Data-Driven Scripts
O A data-driven script stores test data
(inputs & expected outcomes) in a
separate (data) file rather than in the
script itself.
Data-Driven Scripts
- explained
Driver
Test
Script
System
Under Test
Data
File
Data
File
Data
File
System
Under Test
CSV
Excel
XML
Text
Data-Driven Scripts
- Let’s test addition on a calculator
Test Case(s) = Test Data + Driver Test Script
(Python)
Data-Driven Scripts
O Good
O Similar tests can be added very quickly.
O Adding new tests can be done by testers w/o
knowledge of the automation test tool scripting
language.
O Separation of roles: Tester (test data file) + automation
designer (driver scripts)
O Bad
O Driver script is complex. Need good programming
skills.
O One driver script is only good for one kind of testing.
O Changes to either data file or driver script, you’ll need
to change both
Different Scripting Techniques
O Linear scripts
O Structured scripts
O Shared scripts
O Data-driven scripts
O Keyword-driven scripts
How to test square root 𝑛?
Can we re-use addition.py test script?
Driver Test
Script
Data File System
Under Test
Both Data File & Driver Test Script can’t be re-used, need to create new ones
Keyword-Driven Scripts
O Keyword-driven comes from Data-driven to
overcome some limitations:
O One driver script only works for one kind of
tests
O “What to test” is built into both the data file and
driver script, so they need to be synchronized.
O Can we ?
O Use one “driver script” to drive all data files?
O Put “What to test” in just one data file?
From Data-Driven to Keyword-Driven
Driver Test
Script
Data File System
Under Test
Driver
Test
Script
System
Under Test
Data FileData File
Data FileData FileTest Data
File
Keyword
Scripts
Test data
What to test
How to test
Control
logic
Keyword-Driven Scripts
Driver
Test
Script
System
Under Test
Data FileData FileTest Data
File
Keyword
Scripts
open calculator
app
close calculator
app
add two numbers
result should be
. . . .
Keyword-Driven Scripts and Other Scripts
-Mindset change: What to test vs. How to test
Other scripts: Detailed info on what
& how to test
Keyword-Driven scripts:
Just what to test
Sometimes “what to test”
is described in your test
script comments/document
Keyword-Driven Scripts
-Separation of Concerns
Driver
Test
Script
System
Under Test
Data FileData FileTest Data
File
Keyword
Scripts
Test data +
What to test
How to testControl
logic
• Tester
• No need of
programming
skills
• Use
Excel/notepad to
edit Test Data
File
• Tool Designer
• Strong
programming
skills
• Use C++/ Java/
Python/Ruby to
code the 1 and
only 1 driver
test script
• Automation Expert
• Familiar with a scripting
language (Python/ TCL/ test
tool language)
• Good knowledge of the
System Under Test
Keyword-Driven Scripts
O Good
O All goodies from Data-Driven
O Test data file is also readable test document
O Separation of concerns
O Mindset change: What to test vs. How to test
O Bad
O Seen as silver bullet, but it’s not
O Require good knowledge and experience on
both programming and System Under Test to
plan, design and maintain keywords.
O If not well planned, you’ll be happy from the
beginning and suffer/fail in the near future.
I have a question for
you.
Which scripting technique is
better?
Do you have a question for
me?
Email zhongzhu@ymail.com
Or follow me on Sina Weibo @钟柱

More Related Content

What's hot

Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software Testing
Nishant Worah
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
Confiz
 

What's hot (20)

Test automation process
Test automation processTest automation process
Test automation process
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Test Automation Framework Designs
Test Automation Framework DesignsTest Automation Framework Designs
Test Automation Framework Designs
 
Software testing
Software testingSoftware testing
Software testing
 
Unit testing
Unit testing Unit testing
Unit testing
 
for loop in java
for loop in java for loop in java
for loop in java
 
Black box & white-box testing technique
Black box & white-box testing techniqueBlack box & white-box testing technique
Black box & white-box testing technique
 
Types of Software Testing
Types of Software TestingTypes of Software Testing
Types of Software Testing
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsAutomated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from Models
 
Types of testing
Types of testingTypes of testing
Types of testing
 
Test automation framework
Test automation frameworkTest automation framework
Test automation framework
 
Hybrid Automation Framework Development introduction
Hybrid Automation Framework Development introductionHybrid Automation Framework Development introduction
Hybrid Automation Framework Development introduction
 
Automation Framework Presentation
Automation Framework PresentationAutomation Framework Presentation
Automation Framework Presentation
 
Test Automation Best Practices (with SOA test approach)
Test Automation Best Practices (with SOA test approach)Test Automation Best Practices (with SOA test approach)
Test Automation Best Practices (with SOA test approach)
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Automated Testing with Agile
Automated Testing with AgileAutomated Testing with Agile
Automated Testing with Agile
 
Artificial Intelligence for Automated Software Testing
Artificial Intelligence for Automated Software TestingArtificial Intelligence for Automated Software Testing
Artificial Intelligence for Automated Software Testing
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 
Automated Testing vs Manual Testing
Automated Testing vs Manual TestingAutomated Testing vs Manual Testing
Automated Testing vs Manual Testing
 

Similar to Automation test scripting techniques

Qtp important frameworks
Qtp important frameworksQtp important frameworks
Qtp important frameworks
prs0302
 
Final Automation Testing
Final Automation TestingFinal Automation Testing
Final Automation Testing
priya_trivedi
 
Strategy-driven Test Generation with Open Source Frameworks
Strategy-driven Test Generation with Open Source FrameworksStrategy-driven Test Generation with Open Source Frameworks
Strategy-driven Test Generation with Open Source Frameworks
Dimitry Polivaev
 
May: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and ChallengesMay: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and Challenges
TriTAUG
 

Similar to Automation test scripting techniques (20)

Qtp important frameworks
Qtp important frameworksQtp important frameworks
Qtp important frameworks
 
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflowMay 2021 Spark Testing ... or how to farm reputation on StackOverflow
May 2021 Spark Testing ... or how to farm reputation on StackOverflow
 
Data Driven Framework in Selenium
Data Driven Framework in SeleniumData Driven Framework in Selenium
Data Driven Framework in Selenium
 
Final Automation Testing
Final Automation TestingFinal Automation Testing
Final Automation Testing
 
Robot framework
Robot frameworkRobot framework
Robot framework
 
Test automation principles, terminologies and implementations
Test automation principles, terminologies and implementationsTest automation principles, terminologies and implementations
Test automation principles, terminologies and implementations
 
Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)
 
Cypress Testing.pptx
Cypress Testing.pptxCypress Testing.pptx
Cypress Testing.pptx
 
Cucumber jvm best practices v3
Cucumber jvm best practices v3Cucumber jvm best practices v3
Cucumber jvm best practices v3
 
Strategy-driven Test Generation with Open Source Frameworks
Strategy-driven Test Generation with Open Source FrameworksStrategy-driven Test Generation with Open Source Frameworks
Strategy-driven Test Generation with Open Source Frameworks
 
HKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHGHKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHG
 
Selenium Tutorial for Beginners | Automation framework Basics
Selenium Tutorial for Beginners | Automation framework BasicsSelenium Tutorial for Beginners | Automation framework Basics
Selenium Tutorial for Beginners | Automation framework Basics
 
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
APIs And SDKs  Breaking Into And Succeeding In A Specialty MarketAPIs And SDKs  Breaking Into And Succeeding In A Specialty Market
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Test automation
Test automationTest automation
Test automation
 
Google, quality and you
Google, quality and youGoogle, quality and you
Google, quality and you
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
12 Rational Solo Pruebas 2009
12 Rational Solo Pruebas 200912 Rational Solo Pruebas 2009
12 Rational Solo Pruebas 2009
 
May: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and ChallengesMay: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and Challenges
 
A Beginer's Guide to testing in Django
A Beginer's Guide to testing in DjangoA Beginer's Guide to testing in Django
A Beginer's Guide to testing in Django
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Automation test scripting techniques

  • 2. Hello, my name is Zhu Zhong (钟 柱) 12+ years, working on automation test tools Work(ed, ing) for • Nortel • Alcatel-Lucent I like • Write code • Test automation • Drawing • BBQ • Ocarina
  • 3. A Good Book O 13+ years passed so far, automation scripting techniques haven’t changed since the publishing of this book. O All the ideas of this slides come from my understanding of this book plus my experience • by Mark Fewster/ Dorothy Graham • Published: September, 1999
  • 4. What’ll We be Talking About? O We will NOT talk about O How to use an automation test tool (EasyTest , QTP, Robot Framework, etc) O Any specific testing techniques (GUI, Web, etc) O We will talk about O Automation test scripts O Types of scripts & their differences O Which script technique to choose
  • 5. Different Scripting Techniques O Linear scripts O Structured scripts O Shared scripts O Data-driven scripts O Keyword-driven scripts
  • 6. Different Scripting Techniques O Linear scripts O Structured scripts O Shared scripts O Data-driven scripts O Keyword-driven scripts
  • 7. Linear Scripts O A Linear script is what you end up with when you record a test case performed manually. (AutoIt)
  • 8. Is linear scripts Good or Bad?
  • 9. Linear Scripts O Good O Quick start automation O Demonstration or training O Prepare test data O Bad O Hard coded data into scripts O Vulnerable to changes O No sharing or reuse
  • 10. Different Scripting Techniques O Linear scripts O Structured scripts O Shared scripts O Data-driven scripts O Keyword-driven scripts
  • 11. Structured Scripts = Linear scripts + if + for/while loop (scratch)
  • 12. Structured Scripts O Good O More robust O Reuse O Bad O Require programming skills O More complex O Test data still ‘hard-coded’ into the script
  • 13. Different Scripting Techniques O Linear scripts O Structured scripts O Shared scripts O Data-driven scripts O Keyword-driven scripts
  • 14. Shared Scripts O Shared scripts are scripts that are used (or shared) by more than one test case. O May be called reusable script/function library O Hard-coded values -> variables
  • 15. Shared Scripts – an example (EasyTest) Convert shared script to HOST.checkLinuxVersion Test case is simplified: just need to call shared script HOST.checkLinuxVersion
  • 16. Shared Scripts – shared scripts/functions makes a test case easier to read/maintain This is a real test case we used to test EasyTest (Squish)
  • 17. Shared Scripts O Good O Similar tests will take less effort to implement O Reuse: eliminates repetitions. O Keep the changes to a minimum O Bad O Hard to track/find scripts, documents, names and store. O Shared scripts are often specific to part of the system under test.
  • 18. Different Scripting Techniques O Linear scripts O Structured scripts O Shared scripts O Data-driven scripts O Keyword-driven scripts
  • 19. Data-Driven Scripts O A data-driven script stores test data (inputs & expected outcomes) in a separate (data) file rather than in the script itself.
  • 20. Data-Driven Scripts - explained Driver Test Script System Under Test Data File Data File Data File System Under Test CSV Excel XML Text
  • 21. Data-Driven Scripts - Let’s test addition on a calculator Test Case(s) = Test Data + Driver Test Script (Python)
  • 22. Data-Driven Scripts O Good O Similar tests can be added very quickly. O Adding new tests can be done by testers w/o knowledge of the automation test tool scripting language. O Separation of roles: Tester (test data file) + automation designer (driver scripts) O Bad O Driver script is complex. Need good programming skills. O One driver script is only good for one kind of testing. O Changes to either data file or driver script, you’ll need to change both
  • 23. Different Scripting Techniques O Linear scripts O Structured scripts O Shared scripts O Data-driven scripts O Keyword-driven scripts
  • 24. How to test square root 𝑛? Can we re-use addition.py test script? Driver Test Script Data File System Under Test Both Data File & Driver Test Script can’t be re-used, need to create new ones
  • 25. Keyword-Driven Scripts O Keyword-driven comes from Data-driven to overcome some limitations: O One driver script only works for one kind of tests O “What to test” is built into both the data file and driver script, so they need to be synchronized. O Can we ? O Use one “driver script” to drive all data files? O Put “What to test” in just one data file?
  • 26. From Data-Driven to Keyword-Driven Driver Test Script Data File System Under Test Driver Test Script System Under Test Data FileData File Data FileData FileTest Data File Keyword Scripts Test data What to test How to test Control logic
  • 27. Keyword-Driven Scripts Driver Test Script System Under Test Data FileData FileTest Data File Keyword Scripts open calculator app close calculator app add two numbers result should be . . . .
  • 28. Keyword-Driven Scripts and Other Scripts -Mindset change: What to test vs. How to test Other scripts: Detailed info on what & how to test Keyword-Driven scripts: Just what to test Sometimes “what to test” is described in your test script comments/document
  • 29. Keyword-Driven Scripts -Separation of Concerns Driver Test Script System Under Test Data FileData FileTest Data File Keyword Scripts Test data + What to test How to testControl logic • Tester • No need of programming skills • Use Excel/notepad to edit Test Data File • Tool Designer • Strong programming skills • Use C++/ Java/ Python/Ruby to code the 1 and only 1 driver test script • Automation Expert • Familiar with a scripting language (Python/ TCL/ test tool language) • Good knowledge of the System Under Test
  • 30. Keyword-Driven Scripts O Good O All goodies from Data-Driven O Test data file is also readable test document O Separation of concerns O Mindset change: What to test vs. How to test O Bad O Seen as silver bullet, but it’s not O Require good knowledge and experience on both programming and System Under Test to plan, design and maintain keywords. O If not well planned, you’ll be happy from the beginning and suffer/fail in the near future.
  • 31. I have a question for you. Which scripting technique is better?
  • 32. Do you have a question for me? Email zhongzhu@ymail.com Or follow me on Sina Weibo @钟柱

Editor's Notes

  1. If it can’t be found quickly people will write their own version of it.