This example assumes that the Server and URL is the same regardless of the testset, but the ''port is variable based on a field on the testset entity in QC. It could be easily adapted to make ''server'', ''port'' and ''URL'' vary based on the testset as well, by adding other fields to the testset and retreiving their values and concatenating them into the ''FULL_URL'' at the end. This example utilizes the QCUtil object to retreive values from the testset where the test instance lives.
-
Start by splitting the URL parameter into 3 parts:
Server = myServerName
URL = ''/myURL/myURLcontinued''
PORT = ''7001''
-
Create a new field on the test set called ''PORT''.
(example shown below using ''CY_USER_01'' in the database)
-
Then in the QTP script, retreive the value of PORT from the testset:
set myCurrentTestSet= QCUtil.CurrentTestSet
PORT = myCurrentTestSet.Field(''CY_USER_01'')
-
Concatenate the peices into the variable FULL_URL:
FULL_URL = ''http://'' & Server & '':'' & PORT & URL