Using Parameters

Note  This content applies to the Windows Logo Kit (WLK). For the latest information using the new Windows Hardware Certification Kit (HCK), see Windows HCK User's Guide on the Windows Hardware Dev Center.

Job parameters function like user-defined variables--they allow you to pass data from the job itself to the tasks within the job. By using parameters, you can make your jobs easier to modify and reuse.

For example, you could use a parameter to specify the location where data files for a test are stored. To do this, you would define a parameter named DataFileLocation. If there were five tasks in a job that each used the same data file, the tasks could use the parameter to provide the location of the data files. Each task would have a command line of the form:

TestProgram.exe /datafile=[ DataFileLocation]

If you set DataFileLocation to "c:/data/testdata", when each task is executed, TestProgram.exe would receive a datafile argument with the value "C:/Data/TestData".

Parameters can be either global or local. Global parameters are defined on the DTM controller, and can be used within any job on that controller. Local parameters are defined within a job, and can only be used within the job in which they are defined.

Continuing the previous example, if DataFileLocation were a local parameter that was used in a single job, you could debug TestProgram.exe by saving your own test data in one location and giving the DataFileLocation parameter a value that points to your debugging data, such as "C:/Data/TestData". When you were satisfied that TestProgram.exe was correct, you could change the value of the DataFileLocation to the location of the real test data, such as "\\MyServer\Data\TestData".

If DataFileLocation were a global parameter, you could have many jobs that referenced DataFileLocation. If you moved the test data from one server to another, you could change just the value of DataFileLocation; you wouldn't have to modify the jobs that used the DataFileLocation parameter. For example, if you moved the data files from MyServer to MyNewServer, you could simply change the value of the global DataFileLocation parameter from "\\MyServer\Data\TestData" to "\\MyNewServer\Data\TestData". Each job that used the DataFileLocation parameter would now receive the new value.

You can override the value of a parameter when you schedule a job. When you define the parameter--either in the job for a local parameter, or by using the Management Console for global parameters--you can specify a default value and indicate whether the user can override the default value when the job is scheduled.

Continuing the example, if you overrode the value of DataFileLocation when you scheduled the job, you could provide a default location for the test data files in the job's definition and occasionally override the default location with a new location without changing the job. For example, if the test data were stored at \\MyServer\Data\TestData, but you wanted to run MyProgram.exe with data that your customer sent you, you could change the DataFileLocation to "C:/Customer/TestData" when you scheduled the job. This would leave the value of the DataFileLocation parameter the same for every other person who used the job, and it would leave the DataFileLocation value the same the next time that you executed the job, but would allow you to use the customer's data (one time).

To create a new global parameter, see Defining and Modifying Global Parameters.

To define a local parameter in a job

Note  This content applies to the Windows Logo Kit (WLK). For the latest information using the new Windows Hardware Certification Kit (HCK), see Windows HCK User's Guide on the Windows Hardware Dev Center.

  1. Create or edit a job.

  2. On the Parameters tab in the bottom pane of the New Job window, select the Local tab.

  3. Type a name for the parameter in the Name column.

  4. In the Type column, select String.

    Note   Parameters can also have the type FileData. A FileData parameter represents a file whose contents you specify in the job. A separate instance of the file is copied to the client computer each time the job is executed. FileData parameters are used primarily to copy a script to a client computer and to reference the script in the task that runs it. For more information about using FileData parameters, see Using FileData Parameters.

  5. Type a description of what this parameter is used for in the Description column.

  6. If you want the user to be able to override the value of this parameter when the job is scheduled, select the Schedule check box.

  7. In the Value column, enter the default value for this parameter. If you do not enter a value, the default will be an empty string.

    Tip  Parameters can be nested. For example, you could define a parameter named ServerName and give it the value of "MyServer". You could define a second parameter named DataFileLocation and give it the value "\\[ServerName]\Test". You could then use DataFIleLocation within a task, for example, by using the command line:

    TestProgram.exe /datafile=[ DataFileLocation].

    When the task was executed, TestProgram.exe would receive a datafile argument with the value "\\MyServer\Test".

To make a global parameter available within a job

Note  This content applies to the Windows Logo Kit (WLK). For the latest information using the new Windows Hardware Certification Kit (HCK), see Windows HCK User's Guide on the Windows Hardware Dev Center.

  1. Create or edit a job.

  2. On the Parameters tab in the bottom pane of the New Job window, select the Global tab.

    All of the global parameters that have been defined on the controller are displayed.

  3. Select the global parameter that you will use in this job, and then click Add.

    The global parameter is moved to the right pane.

 

 

Build date: 9/14/2012