SlideShare une entreprise Scribd logo
1  sur  7
Regular Expressions in QTP
Sometimes there might be situations where values of objects keep on varying and QTP may fail to
recognize them or checkpoints might get failed as the expected and actual data are not matching. In such
cases Regular expressions come into picture. It enables QTP to identify objects and text strings with
varying values.Regular expressions can be used:
1. In identifying the property values of an object
2. Inparametrization
3. For creation of checkpoints on objects with varying values
1. In identifying property values of an object:
In this concept, let‟s see how to handle QTP when a value of an object is varied. Let‟s walk through this
section with a small example:
Assume that you have to record a scenario of verifying the mails in a mail account. Open the mail with
valid username and password. Now click on Inbox. When you have opened your mail account assume that
there are 5 mails. So the inbox would be showing Inbox (5). When you click on that, the mails get
displayed. Following would be the statement that gets generated when clicked on Inbox:
Browser(“Gmail”).Page(“Gmail”).Link(“Inbox(5)”).click
Now when the same script is run again, QTP fails at the same step as the number of mails in the inbox is
4. Or even more if some new mails have come. The script execution doesn‟t get passed unless the total
number of new mails is again 5. We make use of regular expression here as the value for the number of
mails keeps varying.
For creating a regular expression, go to object repository from ResourcesàObject repository. Select the
link object Inbox (5) from object list displayed in the left side.
Go to the object properties screen displayed in the right side of the screen. Select the property that has the
value Inbox (5). Click on the configure icon that gets displayed there.

„Value configuration Options‟ dialog box gets displayed.
Check the Regular expressions check box. A dialog box gets raised asking the user whether to add a back
slash before each special character in order to treat it literally. As we have special characters „(„ and „)‟ we
need to click on Yes and QTP adds a slash character before both the Parenthesis characters.
If you want qtp script to be successful for 0-9 mails then give the following value in Constant edit box:
Inbox([0-9])
For 0-99 mails
Inbox([0-9][0-9])
For 0-999 mails
Inbox([0-9][0-9][0-9])
Click on OK and close the object repository window. For first option QTP executes the scripts successfully
if the Inbox has 0-9 mails. Second option executes successfully for 0-99 mails and third option for 0-999
mails.
2. In Parameterization:
In some cases, we need to parameterize the varying values in the script. In such cases we parameterize the
values and use the regular expression in parameterized value i.e., in data table sheet where the value is
present. Using the same example mentioned above lets discuss how can be regular expressions in
parameterization process.
Select the link object Inbox (5) from object list displayed in the left side of Object repository.
Go to the object properties screen displayed in the right side of the screen. Select the property that has the
value Inbox (5). Click on the configure icon that gets displayed there.
„Value configuration Options‟ dialog box gets displayed. Set the Parameter Radio button and select the
location of data table (global/local). Enter a title for the column.Now check the Regular expressions
checkbox in advanced configurations option. Click on Yes in the dialog box that gets displayed.

Click on OK and close the object repository window. If you want QTP script to be successful for 0-9 mails
then give the following value in Data table sheet of QTP:
Inbox([0-9])
For 0-99 mails
Inbox([0-9][0-9])
For 0-999 mails
Inbox([0-9][0-9][0-9])

For first option QTP executes the scripts successfully if the Inbox has 0-9 mails. Second option executes
successfully for 0-99 mails and third option for 0-999 mails. Using this example, the values can be
changed directly in the data table sheet.
3. For creation of checkpoints on objects with varying values
Assume that you have to create a text check point on some text which gets varied continuously. In the
same example mentioned above, you need to insert a text checkpoint on Inbox (5) which gets varied
basing on the number of mails available in the inbox. When the checkpoint is created, it takes Inbox (5) as
the expected value and when the same script is run again when there are 4 mails in the inbox, and then
the checkpoint fails. To overcome such situations, regular expressions is used again.
Insert a checkpoint by selecting Insert-->Checkpoint-->Text Checkpoint. (Make sure that QTP is in
recording mode)

Select the text on which you want to insert text checkpoint (i.e., Inbox (5)). Text checkpoint properties
window gets opened.Make sure that the radio button is set to constant dialog box. Click on Constant Value
options icon that gets displayed there.
„Constant Value options‟ dialog box gets displayed. Now check the regular expressions check box and Click
on yes in the dialog box that gets displayed to treat „(„ and „)‟ as literal characters. Now in the same way as
mentioned in the above two examples enter the data as per your requirement.
For 0-9 mails
Inbox([0-9])
For 0-99 mails
Inbox([0-9][0-9])
For 0-999 mails
Inbox([0-9][0-9][0-9])
Click on OK and close the Text checkpoint properties window. For first option QTP checkpoint gets
passed if the Inbox has 0-9 mails. Second option gets passed for 0-99 mails and third option for 0-999
mails.

Contenu connexe

Similaire à Regular Expressions in QTP

C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfC++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfinfo189835
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docxAustinaGRPaigey
 
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - InstructiEX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - InstructiBetseyCalderon89
 
Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...
Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...
Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...Daniel DotNet
 
6.6 Creating Calculated Controls
6.6 Creating Calculated Controls6.6 Creating Calculated Controls
6.6 Creating Calculated ControlsPyi Soe
 
Chapter 05
Chapter 05Chapter 05
Chapter 05llmeade
 
Chapter 05 show
Chapter 05 showChapter 05 show
Chapter 05 showchda01008
 
Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3Bhushan Mulmule
 
JPQL/ JPA Activity 3
JPQL/ JPA  Activity 3JPQL/ JPA  Activity 3
JPQL/ JPA Activity 3SFI
 
Paste Only Plain Text in RichTextBox Control using Visual Basic.Net
Paste Only Plain Text in RichTextBox Control using Visual Basic.NetPaste Only Plain Text in RichTextBox Control using Visual Basic.Net
Paste Only Plain Text in RichTextBox Control using Visual Basic.NetDaniel DotNet
 
Chapter 04
Chapter 04Chapter 04
Chapter 04llmeade
 
Useful macros and functions for excel
Useful macros and functions for excelUseful macros and functions for excel
Useful macros and functions for excelNihar Ranjan Paital
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769subhasis100
 

Similaire à Regular Expressions in QTP (20)

Project1 CS
Project1 CSProject1 CS
Project1 CS
 
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdfC++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
C++ help finish my code Phase 1 - input phase. Main reads the fi.pdf
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
 
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - InstructiEX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
EX19_AC_CH03_GRADER_HOE_AS_InstructionsGrader - Instructi
 
Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...
Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...
Apply Bold, Italic and Underline to Selected Text in a RichtextBox using Visu...
 
Visual basic bt0082
Visual basic  bt0082Visual basic  bt0082
Visual basic bt0082
 
6.6 Creating Calculated Controls
6.6 Creating Calculated Controls6.6 Creating Calculated Controls
6.6 Creating Calculated Controls
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Chapter 05 show
Chapter 05 showChapter 05 show
Chapter 05 show
 
OLT open script
OLT open script OLT open script
OLT open script
 
Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3
 
JPQL/ JPA Activity 3
JPQL/ JPA  Activity 3JPQL/ JPA  Activity 3
JPQL/ JPA Activity 3
 
Paste Only Plain Text in RichTextBox Control using Visual Basic.Net
Paste Only Plain Text in RichTextBox Control using Visual Basic.NetPaste Only Plain Text in RichTextBox Control using Visual Basic.Net
Paste Only Plain Text in RichTextBox Control using Visual Basic.Net
 
Data migration
Data migrationData migration
Data migration
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Mca 504 dotnet_unit5
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
Useful macros and functions for excel
Useful macros and functions for excelUseful macros and functions for excel
Useful macros and functions for excel
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 
Qtp 92 Tutorial769
Qtp 92 Tutorial769Qtp 92 Tutorial769
Qtp 92 Tutorial769
 

Plus de Praveen Gorantla (13)

Troubleshooting with QTP
Troubleshooting with QTPTroubleshooting with QTP
Troubleshooting with QTP
 
File System Object in QTP
File System Object in QTPFile System Object in QTP
File System Object in QTP
 
Recovery Scenario in QTP
Recovery Scenario in QTPRecovery Scenario in QTP
Recovery Scenario in QTP
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
QTP Functions
QTP FunctionsQTP Functions
QTP Functions
 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
 
Dynamic Content in QTP
Dynamic Content in QTPDynamic Content in QTP
Dynamic Content in QTP
 
Business Process Testing
Business Process TestingBusiness Process Testing
Business Process Testing
 
QTP Basics-2
QTP Basics-2QTP Basics-2
QTP Basics-2
 
QTP with QualityCenter
QTP with  QualityCenterQTP with  QualityCenter
QTP with QualityCenter
 
Virtual objects
Virtual objectsVirtual objects
Virtual objects
 
2.regular expressions
2.regular expressions2.regular expressions
2.regular expressions
 
1.qtp basics
1.qtp basics1.qtp basics
1.qtp basics
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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 WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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 FresherRemote DBA Services
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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 DevelopmentsTrustArc
 
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 WorkerThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
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 Scriptwesley chun
 

Dernier (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 

Regular Expressions in QTP

  • 1. Regular Expressions in QTP Sometimes there might be situations where values of objects keep on varying and QTP may fail to recognize them or checkpoints might get failed as the expected and actual data are not matching. In such cases Regular expressions come into picture. It enables QTP to identify objects and text strings with varying values.Regular expressions can be used: 1. In identifying the property values of an object 2. Inparametrization 3. For creation of checkpoints on objects with varying values 1. In identifying property values of an object: In this concept, let‟s see how to handle QTP when a value of an object is varied. Let‟s walk through this section with a small example: Assume that you have to record a scenario of verifying the mails in a mail account. Open the mail with valid username and password. Now click on Inbox. When you have opened your mail account assume that there are 5 mails. So the inbox would be showing Inbox (5). When you click on that, the mails get displayed. Following would be the statement that gets generated when clicked on Inbox: Browser(“Gmail”).Page(“Gmail”).Link(“Inbox(5)”).click Now when the same script is run again, QTP fails at the same step as the number of mails in the inbox is 4. Or even more if some new mails have come. The script execution doesn‟t get passed unless the total number of new mails is again 5. We make use of regular expression here as the value for the number of mails keeps varying. For creating a regular expression, go to object repository from ResourcesàObject repository. Select the link object Inbox (5) from object list displayed in the left side.
  • 2. Go to the object properties screen displayed in the right side of the screen. Select the property that has the value Inbox (5). Click on the configure icon that gets displayed there. „Value configuration Options‟ dialog box gets displayed.
  • 3. Check the Regular expressions check box. A dialog box gets raised asking the user whether to add a back slash before each special character in order to treat it literally. As we have special characters „(„ and „)‟ we need to click on Yes and QTP adds a slash character before both the Parenthesis characters. If you want qtp script to be successful for 0-9 mails then give the following value in Constant edit box: Inbox([0-9]) For 0-99 mails Inbox([0-9][0-9]) For 0-999 mails Inbox([0-9][0-9][0-9])
  • 4. Click on OK and close the object repository window. For first option QTP executes the scripts successfully if the Inbox has 0-9 mails. Second option executes successfully for 0-99 mails and third option for 0-999 mails. 2. In Parameterization: In some cases, we need to parameterize the varying values in the script. In such cases we parameterize the values and use the regular expression in parameterized value i.e., in data table sheet where the value is present. Using the same example mentioned above lets discuss how can be regular expressions in parameterization process. Select the link object Inbox (5) from object list displayed in the left side of Object repository. Go to the object properties screen displayed in the right side of the screen. Select the property that has the value Inbox (5). Click on the configure icon that gets displayed there. „Value configuration Options‟ dialog box gets displayed. Set the Parameter Radio button and select the location of data table (global/local). Enter a title for the column.Now check the Regular expressions checkbox in advanced configurations option. Click on Yes in the dialog box that gets displayed. Click on OK and close the object repository window. If you want QTP script to be successful for 0-9 mails then give the following value in Data table sheet of QTP: Inbox([0-9]) For 0-99 mails Inbox([0-9][0-9])
  • 5. For 0-999 mails Inbox([0-9][0-9][0-9]) For first option QTP executes the scripts successfully if the Inbox has 0-9 mails. Second option executes successfully for 0-99 mails and third option for 0-999 mails. Using this example, the values can be changed directly in the data table sheet. 3. For creation of checkpoints on objects with varying values Assume that you have to create a text check point on some text which gets varied continuously. In the same example mentioned above, you need to insert a text checkpoint on Inbox (5) which gets varied basing on the number of mails available in the inbox. When the checkpoint is created, it takes Inbox (5) as the expected value and when the same script is run again when there are 4 mails in the inbox, and then the checkpoint fails. To overcome such situations, regular expressions is used again. Insert a checkpoint by selecting Insert-->Checkpoint-->Text Checkpoint. (Make sure that QTP is in recording mode) Select the text on which you want to insert text checkpoint (i.e., Inbox (5)). Text checkpoint properties window gets opened.Make sure that the radio button is set to constant dialog box. Click on Constant Value options icon that gets displayed there.
  • 6. „Constant Value options‟ dialog box gets displayed. Now check the regular expressions check box and Click on yes in the dialog box that gets displayed to treat „(„ and „)‟ as literal characters. Now in the same way as mentioned in the above two examples enter the data as per your requirement.
  • 7. For 0-9 mails Inbox([0-9]) For 0-99 mails Inbox([0-9][0-9]) For 0-999 mails Inbox([0-9][0-9][0-9]) Click on OK and close the Text checkpoint properties window. For first option QTP checkpoint gets passed if the Inbox has 0-9 mails. Second option gets passed for 0-99 mails and third option for 0-999 mails.