How to make arguments optional in a function?

Answers were Sorted based on User's Feedback



How to make arguments optional in a function?..

Answer / ramchandra patil

Hi Narendra,

Good question!

See basically QTP does not support optional arguments but u
can achieve this with following ways-

1. You can pass NULL or Empty values
2. By using dictionary object


I am agree with Subbu...
@Meenu we use optional in front of statement if we wanted
to execute the statement at some criteria..we never use
Optional keyword while passing arguments to function...n I
think narendras question is related to function...

hey guys let me know if I am wrong with valid solution and
please do post if u know any other way..


Thanks in Advance..

Ramchandra
9699851282

Is This Answer Correct ?    2 Yes 0 No

How to make arguments optional in a function?..

Answer / akshay kumar

this is not possible as default VBS doesn't support this. Instead you can pass a blank scring and have a default value if arguments r not required.

Is This Answer Correct ?    0 Yes 0 No

How to make arguments optional in a function?..

Answer / murtaza j habib

make any function and call it anywhere in your file

but don't upload that function which showing you a error in
your file because it is useless

Is This Answer Correct ?    0 Yes 1 No

How to make arguments optional in a function?..

Answer / subbu

In QTP we dont use "Optional" keyword just like in VB.
But work around is use Dictionary object. It is just like
multi dimension arrays.

Is This Answer Correct ?    0 Yes 1 No

How to make arguments optional in a function?..

Answer / sushma

Suppose there is alogin window in the user name we can type
any thing but while running its giving som eerror we can
avoid tht error actually
so, we can make tht tsl as an optional so tht if an error
occurs it countinues but not stop
for example
Optional.Dialog("Login").WinEdit("Name:").Set "ssss"
these line make an optional now

Is This Answer Correct ?    1 Yes 7 No

How to make arguments optional in a function?..

Answer / meenu

basically by prefixing 'Optional.' in front of the statement

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More QTP Interview Questions

how to test use the quality control .how to verify the image verification

0 Answers   Wells Fargo,


Hi Small doubt . i am working as Contract employee in XYZ comany thrw ABC Consultancy. so. How i write my resume ? In Professional experience Column. plz send urgent

2 Answers  


how to change the properties of object during run time . plz give the code using flight reservation

2 Answers  


Can you import and export data from XLS and how?

4 Answers  


1. What is extense of Result file in QTP?

7 Answers  


Explain in brief about the QTP Automation Object Model.

1 Answers  


How to parameterize Object Repository?

2 Answers  


When The Low Level Recording is Used in QTP

17 Answers  


What is Distributed testing? How does UFT support it?

0 Answers  


What is test automation framework?which framework does QTP follow?Need some practical explanation as to how u will start ur testing process following a particular framework?

2 Answers   IBM, Sony,


What the genaric function to connect Sql Server using Sql Server Authentication and Windows Authentication

1 Answers  


After fixing the bug, the same bug is raising again and again in new builds what we have to do? That bug is high level bug.

4 Answers   V2 Solutions,


Categories