GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Testing Tools  >  QTP
Go To First  |  Previous Question  |  
 QTP  |  Question 684 of 684    Print  
QTP Regular Expression
What is the significance of regular expression in QTP?


  
Total Answers and Comments: 9 Last Update: October 21, 2009     Asked by: rashidansari1 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: priyankvyas
 
Regular expression is always used to make our search globalize.

To execute the test in QTP every object is searched in the object repository (OR). In real time applications some object's properties always keep changing, so at the time of execution script fails. To overcome it we use "regular expression" for that particular object's property. For example:

1) Record a test where you are inserting one order and than faxing the same order.

2) The order number that is generated during recording may 21 and "Fax Order window title" is generated and saved into OR as "Fax Order No. 21"

3) Now execute the same test, the script will fail because this time order no is modified as 22 and accordingly "Fax Order window title" is modified as "Fax Order No. 22".

4) This time the object "Fax Order No. 22" is not identified or you can understand object is not matched (find) into OR.

5) To make this search better we modify the text property of object into OR as "Fax Order No.*" this will search all the occurrences of window that has text as "Fax Order No"

6) We can also write it as "Fax Order No. [0-9]" because fax order no is a numerical value and this will search only numbers after "Fax Order No. "

So this is the purpose of regular expression in QTP.



Above answer was rated as good by the following members:
pankajshinde1679, sureshbabugottipati
April 11, 2009 22:02:48   #1  
ganeshmukharji Member Since: April 2009   Contribution: 1    

RE: QTP Regular Expression
The Significance of the regular expression is that the name of the windows or the fields will be always keep on changing and the QTP will be dificult to identify the objects like the windows or the fields. so with the help of the regular expression we can able to identify the objects even if the window names or the field names are changing.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 2Overall Rating: -2    
May 05, 2009 02:48:35   #2  
tanishakumar123 Member Since: May 2009   Contribution: 1    

RE: QTP Regular Expression
Regular expressions can be used via discriptive programming to browser or any window which when invoked everytime will have same name followed by some numeric value.
Also we can do better matching using regular expressions.

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
May 06, 2009 06:55:12   #3  
priyankvyas Member Since: December 2008   Contribution: 12    

RE: QTP Regular Expression
Regular expression is always used to make our search globalize.

To execute the test in QTP every object is searched in the object repository (OR). In
real time applications some object's properties always keep changing so at the
time of execution script fails. To overcome it we use "regular expression" for
that particular object's property. For example:

1) Record a test where you are inserting one order and than faxing the same order.

2) The order number that is generated during recording may 21 and Fax Order window title is generated and saved into OR as Fax Order No. 21


3) Now execute the same test the script will fail because this time order no is modified as 22 and accordingly Fax Order window title is modified as Fax Order No. 22 .


4) This time the object Fax Order No. 22 is not identified or you can understand object is not matched (find) into OR.

5) To make this search better we modify the text property of object into OR as Fax Order No.* this will search all the
occurrences of window that has text as Fax Order No

6) We can also write it as Fax Order No. [0-9] because fax order no is a numerical value and this will search only numbers after Fax Order No.

So this is the purpose of regular expression in QTP.



 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
June 01, 2009 09:10:50   #4  
harrylei Member Since: May 2009   Contribution: 3    

RE: QTP Regular Expression
QTP Regular Expressions enable QTP to identify objects and text strings with varying values. you can use regular expressions in three situations:
1
Defining the property values of an object in dialog boxes or in programmatic descriptions
2
Parameterizing a step
3 Creating checkpoints with varying values

For example you can use a regular expression if you want to create a text checkpoint on a year text string but the displayed year changes according to the current date. if you define the year as a regular expression the checkpoint checks that captured text string matches the expected year format rather than checking the exact year value. 2008 2009 2007 ...
[1900-2099]



 
Is this answer useful? Yes | No
June 03, 2009 12:38:28   #5  
lagoku08 Member Since: April 2009   Contribution: 6    

RE: QTP Regular Expression
To handle the dynamics objects either window/web based application. To handle the objects those name having string along with number the number may change in every execution or every particular time. To handle these objects we can use regular expression.
It have 5 types
1. Dot - .
2. regular expression
3. Star - *
4. Carat - ^
5. Range - [ ]

 
Is this answer useful? Yes | No
June 03, 2009 13:31:13   #6  
harrylei Member Since: May 2009   Contribution: 3    

RE: QTP Regular Expression

The significane of Regular Expression means Changing Fields and Windows could be automated confirmed The text and number changing in this kind of fields and window are able to be running testing scripts to do it.


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
June 27, 2009 10:09:53   #7  
sujata_2221981 Member Since: May 2009   Contribution: 9    

RE: QTP Regular Expression
You can use regular expression to recognise any property that take dyamic values.
 
Is this answer useful? Yes | No
September 17, 2009 03:30:35   #8  
prabahar_a Member Since: September 2009   Contribution: 1    

RE: QTP Regular Expression
* To Handle Dynamic Objects in Web/Windows based application we can Regular Expression..

* While Running the Test in QTP every object is searched in OR. Dynamic Objects which changes its value can be Identified by using Regular Expression.

 
Is this answer useful? Yes | No
October 21, 2009 10:51:24   #9  
debi_m19 Member Since: June 2008   Contribution: 5    

RE: QTP Regular Expression
Regular expressions are typically used while passing parameters either from datatable or from environment table.
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape