I created a user defined field in QC with the label "Test Environment" in the Execution Grid. User can set it to values such as "Test1", "Test2", "Dev1", "UAT1" so on. When you run the QTP test, I need QTP to be able to read the value selected and then update a variable located in the test's associated function file so that it can be used to invoke the appropriate AUT test version.
The part I am stuck at is the code that will read from QC. I'm sure someone has tried this before. Any suggestions?
You can use the Open Test Architecture (OTA) to connect to QC, either from within a QTP test using QCUtil, or from a vbscript using TDConnection.
where TS_USER_xx is your "Test Environment" field. The "Test Environment" is your label, and TS_USER_01 etc is the name of the field. You can view that in QC if you are the QCAdmin by going to Tools > Customize > Project Entities > Test > User defined fields.
No sense bein' a grifter if it's the same as being a citizen.