Synthesizing SVT Data

From PeformIQ Upgrade
Revision as of 09:05, 16 April 2008 by PeterHarding (talk | contribs)
Jump to navigation Jump to search

Overview

Preparing data for performance tests is a very important part of the preparation phase for a load test exercise. The following scripts provide simple examples of approaches to synthesize parameter data for use by the test scripts.

User Login IDs

#!/usr/bin/env python

print 'UserId'

for i in range(200):
   print "svt%03d" % i

Unquoting URL Data

#!/usr/bin/env python

import urllib                                                                                                                                                                       

encoded_data = """                                                                                   %3CPromptEngineRuntimeContext%20xmlns%3D%22http%3A%2F%2Fwww.crystaldecisions.com%2Freport%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%20xmlns%3Axsd%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%22%20xsi%3Atype%3D%22PromptEngineRuntimeContext%22%20version%3D%222%22%3E%3CID%3E{MachineXID}%3C%2FID%3E%3CRenderOption%20xsi%3Atype%3D%22PromptingHTMLRenderOption%22%20id%3D%221%22%3E%3CLocaleID%3E3081%3C%2FLocaleID%3E%3CFormID%3Ecrparam%3C%2FFormID%3E%3CPostbackURL%3E..%2F..%2F..%2FInfoView%2FCrystalEnterprise_Report%2Fschedule%2Fparam.do%3Faction%3Dsetparam%26amp%3Bparamid%3D7%26amp%3Bgroupid%3Deor%3A%2F%2FHCOSDC237.HQ.AUSPOST.COM.AU%2FAdUd7DbLyDtCtFkZPydQDAw%3C%2FPostbackURL%3E%3CResourceURL%3E..%2F..%2F..%2Fviewers%2Fcrystalreportviewers115%2Fprompting%3C%2FResourceURL%3E%3CValueID%3Epevalue%3C%2FValueID%3E%3CContextID%3Epecontexthandle%3C%2FContextID%3E%3CWriteFormTag%3Efalse%3C%2FWriteFormTag%3E%3CWriteSubmit%3Etrue%3C%2FWriteSubmit%3E%3CWriteCancel%3Ef"                                                                                                "Instance%26gt%3B%26lt%3BInstance%20xsi%3Atype%3D%22CRParameterInstance%22%20id%3D%224%22%26gt%3B%26lt%3BOwner%26gt%3B%26lt%3B%2FOwner%26gt%3B%26lt%3BDefinition%20xsi%3Atype%3D%22Parameter%22%20id%3D%225%22%26gt%3B%26lt%3BName%26gt%3BFacility%26lt%3B%2FName%26gt%3B%26lt%3BValueType%26gt%3BString%26lt%3B%2FValueType%26gt%3B%26lt%3BPromptGroupRef%26gt%3Beor%3A%2F%2FHCOSDC237.HQ.AUSPOST.COM.AU%2FAdUd7DbLyDtCtFkZPydQDAw%26lt%3B%2FPromptGroupRef%26gt%3B%26lt%3BConstraintRef%20xsi%3Atype%3D%22PromptGroupConstraint%22%20id%3D%226%22%26gt%3B%26lt%3BName%26gt%3B%26lt%3B%2FName%26gt%3B%26lt%3BDesc%26gt%3B%26lt%3B%2FDesc%26gt%3B%26lt%3BMandatory%26gt%3Bfalse%26lt%3B%2FMandatory%26gt%3B%26lt%3BFrom%26gt%3B0%26lt%3B%2FFrom%26gt%3B%26lt%3BTo%26gt%3B0%26lt%3B%2FTo%26gt%3B%26lt%3B%2FConstraintRef%26gt%3B%26lt%3B%2FDefinition%26gt%3B%26lt%3B%2FInstance%26gt%3B%26lt%3B%2FParameterInstances%26gt%3B%3C%2FUserData%3E%3C%2FWorkingUnits%3E%3CNextPID%3E2%3C%2FNextPID%3E%3C%2FPromptEngineRuntimeContext%3E", ENDITEM,                                                                          "Name=pevalue", "Value=cascadingPID=pid0{MachineXID}&pid0{MachineXID}=Sydney%20West%20LF                                                                            """                                                                                                                                                                                 

data = urllib.unquote(encoded_data)                                                                                                                                                               

print data                           

Other Examples