Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C# Environment property using QTP API
#1
Not Solved
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:
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP is not identifying table with column names property but its identifing with index Anuradha B 1 2,805 02-12-2015, 04:00 PM
Last Post: Kirill
  How to retrieve ArrayList saved in Environment Variable Gautam26 8 4,432 11-07-2013, 08:26 PM
Last Post: ssvali
  Browser name property is empty when QTP spy wshrutika 4 3,205 10-05-2012, 03:20 PM
Last Post: wshrutika
  Array as User-Defined Environment Variables Arena 3 4,107 04-16-2012, 09:19 AM
Last Post: sshukla12
  programming to use different external file of environment variables bundfromnj 1 3,670 01-19-2012, 05:32 PM
Last Post: SteveS

Forum Jump:


Users browsing this thread: 1 Guest(s)