Developer Documentation Library > Interviewer - Server > Monitoring and tuning system performance > UNICOM Intelligence Load Tool > Writing UNICOM Intelligence Load Tool scripts
 
Writing UNICOM Intelligence Load Tool scripts
You can write .mrs scripts to run UNICOM Intelligence Load Tool.
Example script 1
 
' Project names
Const PROJECT_NAME = "Tea"
' Tests Directory
Const TESTS_DIR = "C:\"

Dim loadTool
' Create the UNICOM Intelligence Interviewer Load Tool instance
' If the tests directory is not set, the UNICOM Intelligence Interviewer Load Tool default
' is retrieved from the registry setting
' HKEY_LOCAL_MACHINE\Software\SPSS\mrInterview\3\LoadTool\TestsDirectory
Set loadTool = CreateObject("SPSSMR.DataCollection.Utilities.InterviewLoadTool")

' Set the tests directory
loadTool.TestsDirectory = TESTS_DIR

' Get the tests
Dim tests
Set tests = loadTool.Tests

' Add a new test
Dim TeaTest
Set TeaTest = tests.AddNew(PROJECT_NAME)

' Set the mandatory attributes for the test. These are
' Url, ProjectName, and UseSampleManagement
TeaTest.Url = "http://green/mrIWeb/mrIWeb.dll"
TeaTest.ProjectName = PROJECT_NAME
TeaTest.SampleManagement.UseSampleManagement = False

' Configure the following optional attributes
' RunForNumberOfTimes (default for ExecutionStrategy is "RunForDuration")
' SimultaneousInterviews (default is 10 concurrent interviews)
' MaxDelayBetweenResponses (default is between 1 and 20 seconds)
TeaTest.ExecutionStrategy = 1
TeaTest.RunForNumberOfTimes = 50
TeaTest.SimultaneousInterviews = 2
TeaTest.Respondent.MaxDelayBetweenResponses = 1

' Save the test
TeaTest.Save()

' Run the test
TeaTest.Run()

' Wait until the tests are complete
loadTool.WaitUntilAllTestsComplete()
Sleep(2000)
Example script 2
The following script demonstrates the phone test:
' Project names
Const PROJECT_ID = "Phone"

' Tests Directory
Const TESTS_DIR = "C:\"
Dim loadTool

' Create the UNICOM Intelligence Interviewer Load Tool instance
' If the tests directory is not set, the UNICOM Intelligence Interviewer Load Tool default
' is retrieved from the registry setting
' HKEY_LOCAL_MACHINE\Software\SPSS\mrInterview\3\LoadTool\TestsDirectory
Set loadTool = CreateObject("SPSSMR.DataCollection.Utilities.InterviewLoadTool")

' Set the tests directory
loadTool.TestsDirectory = TESTS_DIR

' Get the tests
Dim tests
Set tests = loadTool.Tests

' Add a new test
Dim phoneTest
Set phoneTest = tests.AddNew(PROJECT_ID)

' Set the mandatory attributes for the test. These are
' Url, ProjectName
phoneTest.Url = "http://ServerName/spssmr/dimensionnet/default.aspx"
phoneTest.ProjectName = PROJECT_ID

'1 indicates Phone test, 0 indicates Web test.
phoneTest.TestTypes = 1
phoneTest.Respondent.CompleteRunningInterviews = true

' UsersAndRoles.xls supports the interviewers to login DataCollection
phoneTest.Interviewer.InterviewerLogins.Load("D:\LoadToolTest\UsersAndRoles.xls", "LoadTester")
' Configure the following optional attributes
' RunForNumberOfTimes (default for ExecutionStrategy is "RunForDuration")
' SimultaneousInterviews (default is 10 concurrent interviews)
' MaxDelayBetweenResponses (default is between 1 and 20 seconds)
' 0 indicates RunForDuration, 1 indicates RunForNumberOfTimes
phoneTest.ExecutionStrategy = 0
phoneTest.RunForDuration = 60
phoneTest.SimultaneousInterviews = 2
phoneTest.Respondent.MaxDelayBetweenResponses = 1

' Save the test
phoneTest.Save()

' Run the test
phoneTest.Run()

' Wait until the tests are complete
loadTool.WaitUntilAllTestsComplete()
Sleep(2000)
Example script 3
The following script demonstrates the test to create responses from a data source:
' Project names
Const PROJECT_NAME = "Tea"
' Tests Directory
Const TESTS_DIR = "C:\"
'
Const SourceName = "source"
Dim loadTool

' Create the Load Tool instance
' If the tests directory is not set, the Load Tool default
' is retrieved from the registry setting
' \HKEY_LOCAL_MACHINE\Software\SPSS\mrInterview\3\LoadTool\TestsDirectory
Set loadTool = CreateObject("SPSSMR.DataCollection.Utilities.InterviewLoadTool")

' Set the tests directory
loadTool.TestsDirectory = TESTS_DIR

' Get the tests
Dim tests
Set tests = loadTool.Tests

' Add a new test
Dim TeaTest
Set TeaTest = tests.AddNew(PROJECT_NAME)

' Set the mandatory attributes for the test. These are
' Url, ProjectName, and UseSampleManagement
TeaTest.Url = "http://green/mrIWeb/mrIWeb.dll"
TeaTest.ProjectName = PROJECT_NAME
TeaTest.SampleManagement.UseSampleManagement = False
' Configure the following optional attributes

' RunForNumberOfTimes (default for ExecutionStrategy is "RunForDuration")
' SimultaneousInterviews (default is 10 concurrent interviews)
' MaxDelayBetweenResponses (default is between 1 and 20 seconds)
TeaTest.ExecutionStrategy = 1' RunForNumberOfTimes
TeaTest.SimultaneousInterviews = 2
TeaTest.Respondent.MaxDelayBetweenResponses = 1

' you can specify the detailed number
TeaTest.RunForNumberOfTimes = 2

' Specify the data source that provides the answer value for the question
TeaTest.SourceConnection = "Provider=mrOleDB.Provider.2;" + _
"Data Source=mrDataFileDsc;" + _
"Location=.\" + SourceName + ".ddf;" + _
"Initial Catalog=.\" + SourceName + ".mdd;" + _
"MR Init Category Names=1"

' Specify select clause for querying the data source
TeaTest.SourceSql = "SELECT * FROM VDATA"

' Save the test
TeaTest.Save()

' Run the test
TeaTest.Run()

' Wait until the tests are complete
loadTool.WaitUntilAllTestsComplete()
Sleep(2000)
Set the following code in order to simulate the Create the same number of interviews as specified in the source above option in the user interface:
TeaTest.ExecutionStrategy = 1 ' RunForNumberOfTimes
TeaTest.RunForNumberOfTimes = -1 ' use the same number as the source
Notes
Before you run your script, make sure that the projects you will be using have been activated to the server on which you will be running the script.
The Sleep statement at the end of the script is required to get around a problem with WaitUntilAllTestsComplete whereby the load tool thinks that the previous interview is running when it is not.
When using the phoneTest.Interviewer.InterviewerLogins.Load statement in the phone test script to load interviewers, the UNICOM Intelligence Load Tool loads roles from the Roles spreadsheet and determines if the Roles parameter is valid. The loaded users belong to the Roles from the Users spreadsheet. Using the following UsersAndRoles.xsl tables as examples:
Roles
RoleName
Description
ProjMan
Project Managers
LoadTester
Load tester
Analysis
Scriptwriters
Users
UserName
Description
Password
Roles
Position
benjamin
Benjamin Brown
Rabb1ts
ProjMan;
Scriptwriter;
Load Tester
1
jose
Jose Mendoza
J6KTSY
Scriptwriter
2
davinder
Davinder Patel
Pandora99
LoadTester
3
See also
UNICOM Intelligence Load Tool