Viewing tests with substitution parameters

You may view all the tests under the Dynatrace Synthetic Monitoring account that have substitution parameters and discover the current values of the substitution parameters (both global and site-level parameters). Call GetParameterizedTests(), sending the following message to the Test Management Web Service:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:prov="http://www.gomeznetworks.com/schemas/provisioning">
   <soapenv:Header/>
   <soapenv:Body>
      <prov:GetParameterizedTestsRequest>
         <prov:Credentials>
            <prov:UserName>testuser</prov:UserName>
            <prov:Password>testpassword</prov:Password>
         </prov:Credentials>
      </prov:GetParameterizedTestsRequest>
   </soapenv:Body>
</soapenv:Envelope>

A sample response appears below:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetParameterizedTestsResponse
           xmlns="http://www.gomeznetworks.com/schemas/provisioning">
         <ResponseStatus>SUCCESS</ResponseStatus>
         <ParameterizedMonitor monitorId="208123"
                               createDate="2012-03-26T20:46:05.207"
                               modifyDate="2012-03-26T20:46:06.657"
                               monitorStatus="Active">
            <SubstitutionParameters>
               <SubstitutionParameter id="0" name="test1" value="test2"/>
               <SubstitutionParameter id="1" name="test3" value="test4"/>
            </SubstitutionParameters>
            <MonitorSites>
               <MonitorSite siteId="886"/>
            </MonitorSites>
         </ParameterizedMonitor>
         <ParameterizedMonitor monitorId="208986"
                               createDate="2011-12-22T13:40:58.1"
                               modifyDate="2012-05-25T05:55:50.317"
                               monitorStatus="Active">
            <SubstitutionParameters>
               <SubstitutionParameter id="0" name="new param1" value="value1"/>
               <SubstitutionParameter id="1" name="new param2" value="value2"/>
               <SubstitutionParameter id="2" name="new param3" value="value3"/>
               <SubstitutionParameter id="3" name="new param4" value="w346"/>
            </SubstitutionParameters>
            <MonitorSites>
               <MonitorSite siteId="886"/>
            </MonitorSites>
         </ParameterizedMonitor>
       </GetParameterizedTestsResponse>
   </soap:Body>
</soap:Envelope>

The SubstitutionParameters element, when it appears as child of ParameterizedMonitor, contains global substitution parameter definitions. Each has a unique numeric ID within the script, a unique name, and a value that the browser agent will use as the default value of the parameter if no site-level value has been provided. From the response, you can see the sites where each test has been deployed (represented as MonitorSite elements). If site-level values have been defined for the substitution parameters, they will appear in a SubstitutionParameters element inside the MonitorSite element. Here is an example of a parameterized monitor:

<ParameterizedMonitor monitorId="328056"
                      createDate="2012-11-07T14:22:56.913"
                      modifyDate="2012-11-07T14:23:03.963"
                      monitorStatus="Active">
	<SubstitutionParameters>
		<SubstitutionParameter id="0" name="UserName" value="MyName"/>
		<SubstitutionParameter id="1" name="Password" value="MyPassword"/>
	</SubstitutionParameters>
	<MonitorSites>
		<MonitorSite siteId="777">
		  <SubstitutionParameters>
		     <SubstitutionParameter id="0" name="UserName" value="MyName 777"/>
		     <SubstitutionParameter id="1" name="Password" value="MyName 777"/>
		  </SubstitutionParameters>
		</MonitorSite>
	</MonitorSites>
</ParameterizedMonitor>

Each site-level substitution parameter must match a global substitution parameter within the same ParameterizedMonitor on ID and name. The value of the site-level substitution parameter will differ from the value in the corresponding global substitution parameter and will be used when the test is run on that site. Use site-level substitution parameters to allow a test to run under a different user for each site where the test is deployed.