SlideShare a Scribd company logo
QTP Training Session V

Presented By : Aisha Mazhar
       Aug-16-2012
Agenda - Advance
•   Conditional Statements
•   Error Handling
•   Inserting Transaction Points
•   Schedule execution of scripts.
•   Executing scripts made by others
Conditional Statements
• Enables you to control the flow of your Test or
  component. Two ways:

•   If Then Else – Decision making, evaluates whether a condition is true or
    false, and then based upon the result certain set of statements are run.
    You can check multiple conditions within a single If statement
    using And & Or operators

•   Using Case - Works on a single expression which is evaluated at the
    beginning on the Select Case statement. The result of the expression is
    then compared with the values for each Case in the structure
Error Handling
IF Else

Not IF

Specifying the Response to an Error
Recovery Scenario
• Recovery scenario gives you an option to take some
  action for recovering from a fatal error in the test.

•   Trigger: Trigger is nothing but the cause for initiating the recovery scenario. It
    could be any popup window, any test error, particular state of an object or
    any application error.
•   Action: Defines what needs to be done if scenario has been triggered. It can
    consist of a mouse/keyboard event, close application, call a recovery function
    defined in library file or restart windows. You can have a series of all the
    specified actions.
•   Post-recovery operation: Basically defined what need to be done after the
    recovery action has been taken. It could be to repeat the step, move to next
    step etc.
When to use a Recovery Scenario and when to
         us on error resume next?
• Recovery scenarios are used when you cannot predict at what
  step the error can occur or when you know that error won't
  occur in your QTP script but could occur in the world outside
  QTP, again the example would be "out of paper", as this error
  is caused by printer device driver.

• "On error resume next" should be used when you know if an
  error is expected and don't want to raise it, you may want to
  have different actions depending upon the error that
  occurred. Use err.number & err.description to get more
  details about the error.
Transaction Point
• A utility object called Services for measuring
  transaction time.
• To find out execution time of the by using the
  start transaction and end transaction points
Schedule execution of scripts
1. Create a .vbs file to launch QTP with required settings, add-ins etc.
2. Go To Start > Control Panel > Schedule Tasks > Click Add Schedule Tasks
   Click Next on the screen.
3. Click Browse and select the .vbs file you just created. You will get this
   screen
4. Give a name to the task and select the frequency for performing the given
   tasks. For this demo we will select "One time only“
5. Select Start Time and Start Date. For this demo, select Start Time as
   current time+5 mins and Start date as today's date.
6. Next Screen Enter "UserName", "Password" and "Confirm Password" Click
   Next and you should get this screen.
7. Click on Finish.
Executing scripts made by others
• Your Scripts will be executed by others as
  well. Make sure following points.

  – Write instructions what and how the steps are
    executed.
  – Use comment blocks to define your actions.
  – Make the script easily readable, format it
  – Using of self explanatory variables.
Advantages
• Can execute and share the code on different
  machines.
• No objects storage required.
• Change in object properties does not interupt
  whole application.
• Its fun in learning and writing your test
  yourself 
Thank you 

More Related Content

PDF
Write better, stronger, faster behat steps with ScenarioStateBehatExtension
PDF
Albert Witteveen - With Cloud Computing Who Needs Performance Testing
PDF
How to Record Scripts in JMeter? JMeter Script Recording Tutorial | Edureka
PPTX
PAC 2019 virtual Stephen Townshend
PPTX
Qtp training session I
PPTX
Antifragility and testing for distributed systems failure
PPT
Effective Test Driven Database Development
PDF
DRAKON Visual Language: Tutorial. Part 2
Write better, stronger, faster behat steps with ScenarioStateBehatExtension
Albert Witteveen - With Cloud Computing Who Needs Performance Testing
How to Record Scripts in JMeter? JMeter Script Recording Tutorial | Edureka
PAC 2019 virtual Stephen Townshend
Qtp training session I
Antifragility and testing for distributed systems failure
Effective Test Driven Database Development
DRAKON Visual Language: Tutorial. Part 2

Similar to Qtp training session V (20)

DOC
Qtp Summary
PDF
Speed geeking-lotusscript
PDF
SAP Testing Training
PDF
QTP Faqs
PPTX
Qtp vb scripting
DOC
Qtp syllabus
PPT
AVB201.2 Microsoft Access VBA Module 2
DOC
Qtp (basics to advanced)
PPT
Testing Presentation
PPT
Vba class 4
PPT
QTP Slides Presentation.
PPT
N Dhanasekaran 2008-2009 Quick Test Professional Presentation
PPT
Qtp Slides
PPTX
Debugging
PDF
Interview qa
DOC
QTP Online Training
DOC
QTP Training
DOCX
Vb script tutorial
PPT
VBscript
Qtp Summary
Speed geeking-lotusscript
SAP Testing Training
QTP Faqs
Qtp vb scripting
Qtp syllabus
AVB201.2 Microsoft Access VBA Module 2
Qtp (basics to advanced)
Testing Presentation
Vba class 4
QTP Slides Presentation.
N Dhanasekaran 2008-2009 Quick Test Professional Presentation
Qtp Slides
Debugging
Interview qa
QTP Online Training
QTP Training
Vb script tutorial
VBscript
Ad

Recently uploaded (20)

PPTX
Tartificialntelligence_presentation.pptx
PDF
Unlock new opportunities with location data.pdf
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
Chapter 5: Probability Theory and Statistics
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Getting Started with Data Integration: FME Form 101
PDF
Architecture types and enterprise applications.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Hybrid model detection and classification of lung cancer
Tartificialntelligence_presentation.pptx
Unlock new opportunities with location data.pdf
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Getting started with AI Agents and Multi-Agent Systems
Chapter 5: Probability Theory and Statistics
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Enhancing emotion recognition model for a student engagement use case through...
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Module 1.ppt Iot fundamentals and Architecture
DP Operators-handbook-extract for the Mautical Institute
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
Zenith AI: Advanced Artificial Intelligence
Getting Started with Data Integration: FME Form 101
Architecture types and enterprise applications.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Hybrid model detection and classification of lung cancer
Ad

Qtp training session V

  • 1. QTP Training Session V Presented By : Aisha Mazhar Aug-16-2012
  • 2. Agenda - Advance • Conditional Statements • Error Handling • Inserting Transaction Points • Schedule execution of scripts. • Executing scripts made by others
  • 3. Conditional Statements • Enables you to control the flow of your Test or component. Two ways: • If Then Else – Decision making, evaluates whether a condition is true or false, and then based upon the result certain set of statements are run. You can check multiple conditions within a single If statement using And & Or operators • Using Case - Works on a single expression which is evaluated at the beginning on the Select Case statement. The result of the expression is then compared with the values for each Case in the structure
  • 4. Error Handling IF Else Not IF Specifying the Response to an Error
  • 5. Recovery Scenario • Recovery scenario gives you an option to take some action for recovering from a fatal error in the test. • Trigger: Trigger is nothing but the cause for initiating the recovery scenario. It could be any popup window, any test error, particular state of an object or any application error. • Action: Defines what needs to be done if scenario has been triggered. It can consist of a mouse/keyboard event, close application, call a recovery function defined in library file or restart windows. You can have a series of all the specified actions. • Post-recovery operation: Basically defined what need to be done after the recovery action has been taken. It could be to repeat the step, move to next step etc.
  • 6. When to use a Recovery Scenario and when to us on error resume next? • Recovery scenarios are used when you cannot predict at what step the error can occur or when you know that error won't occur in your QTP script but could occur in the world outside QTP, again the example would be "out of paper", as this error is caused by printer device driver. • "On error resume next" should be used when you know if an error is expected and don't want to raise it, you may want to have different actions depending upon the error that occurred. Use err.number & err.description to get more details about the error.
  • 7. Transaction Point • A utility object called Services for measuring transaction time. • To find out execution time of the by using the start transaction and end transaction points
  • 8. Schedule execution of scripts 1. Create a .vbs file to launch QTP with required settings, add-ins etc. 2. Go To Start > Control Panel > Schedule Tasks > Click Add Schedule Tasks Click Next on the screen. 3. Click Browse and select the .vbs file you just created. You will get this screen 4. Give a name to the task and select the frequency for performing the given tasks. For this demo we will select "One time only“ 5. Select Start Time and Start Date. For this demo, select Start Time as current time+5 mins and Start date as today's date. 6. Next Screen Enter "UserName", "Password" and "Confirm Password" Click Next and you should get this screen. 7. Click on Finish.
  • 9. Executing scripts made by others • Your Scripts will be executed by others as well. Make sure following points. – Write instructions what and how the steps are executed. – Use comment blocks to define your actions. – Make the script easily readable, format it – Using of self explanatory variables.
  • 10. Advantages • Can execute and share the code on different machines. • No objects storage required. • Change in object properties does not interupt whole application. • Its fun in learning and writing your test yourself 