08-03-2012, 06:51 PM
Hello,
I'm currently working on converting a tool from VBS to C# which intends to launch automatically QTP scripts stored on QC.
In the VBS tool, we're using user-defined environment variables to pass parameters to QTP scripts. I'm trying to do the same using C# but I don't know how to use the Test.Environment property since it's of "object" type. Indeed, using auto-completion in Visual Studio, no method or property is suggested.
In VBS, I have the following code:
In C#, here is the equivalent:
I would really appreciate if someone could give me a hint to solve this issue.
Best regards,
--
Aymeric
I'm currently working on converting a tool from VBS to C# which intends to launch automatically QTP scripts stored on QC.
In the VBS tool, we're using user-defined environment variables to pass parameters to QTP scripts. I'm trying to do the same using C# but I don't know how to use the Test.Environment property since it's of "object" type. Indeed, using auto-completion in Visual Studio, no method or property is suggested.
In VBS, I have the following code:
Code:
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Open SCRIPT_PATH, true, true
qtApp.Test.Environment.Value("My_Param") = 5
In C#, here is the equivalent:
Code:
Application qtpApp = new Application();
qtpApp.Open(SCRIPT_PATH, false, true);
Console.WriteLine(">>> Environment: {0}", qtpApp.Test.Environment.ToString()); // Returns "System._COMObject"
I would really appreciate if someone could give me a hint to solve this issue.
Best regards,
--
Aymeric