Give an example of a regular expression,user-defined function and built-in-function?how to make a user-defined function reusable?

Showing Answers 1 - 2 of 2 Answers

Nageswara Rao G

  • Jan 29th, 2006
 

Regular Expressions: These r enable QT to identify Objects and Text Strings with varying values.There r so many examples for Regular expressions . plz refer Visual Basic6.0 any reference book.For example, start.* matches start, started, starting, starter, etc. You can use a combination of brackets and an asterisk to limit the search to a combination of non-numeric characters. For example: [a-zA-Z]* User Defined Functions: You can write your user-defined function directly into your test or component if you want to limit its use only to the local action or component, or you can store the function in an associated library file to make it available to many actions and tests or components (recommended). Note that if the same function name exists locally within your action or component and within an associated library file, QuickTest uses the function defined in the action or component. Function MyFuncWithParam (obj, x) dim y y = obj.GetROProperty("value") Reporter.ReportEvent micDone, "previous value", y MyFuncWithParam=obj.Set (x) End Function Built_in Function:QuickTest provides a set of built-in variables that enable you to use current information about the test and the QuickTest computer running your test. These can include the test name, the test path, the operating system type and version, and the local host name. (if u have any queries regarding QTP, plz send gnrao10@gmail.com)

  Was this answer useful?  Yes

Hi...
Regular Expression is a pattern matching, where we can test the number of combinations at a time,like for charcters [a-z/A-Z], for numbers [0-9],we can also take apecial charcters for other usage.

Ex: Matching an IP address is another good example of a trade-off between regex complexity and exactness. bd{1,3}.d{1,3}.d{1,3}.d{1,3}b will match any IP address.

User defind functiions are functions which can be defind by us  as for our requirements, that can be .vbs file or .Txt file

Built-in functions are functions which are defined by QTP itself,like Click,Slecet,GetRoProperty()etc

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions