Forum Discussion
okcjosh
13 years agoOccasional Contributor
Rao,
You're a lifesaver! Everything works with one exception. The value of STATE. I am getting errors when I inserting the testRunner method. Please advise. The updated groovy script as well as the error are attached. Please see section of "Identification State"
If I comment out the testRunner method everything works fine, when I try to use it, with many variations, I get the following error.
You're a lifesaver! Everything works with one exception. The value of STATE. I am getting errors when I inserting the testRunner method. Please advise. The updated groovy script as well as the error are attached. Please see section of "Identification State"
// This Groovy Script was designed to be used in SoapUI to automatically generate random customer profiles
def random = new Random()
def xxx = { String alphabet, int n ->
new Random().with {(1..n).collect
{ alphabet[ nextInt( alphabet.length() ) ] }.join() } }
def state =
["AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID",
"IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS",
"MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR",
"PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"]
// This creates a random Email address
email = xxx ( (('A'..'Z')+('0'..'9')).join(), 12 )+ '@42.okcjosh.com'
testRunner.testCase.setPropertyValue( "EMAIL", email )
log.info"EmailAddress $email"
// This creates a random First Name
firstname = (xxx ( (('A'..'Z')).join(), 8 ))
testRunner.testCase.setPropertyValue( "FIRST_NAME", firstname )
log.info"FirstName $firstname"
// This creates a random Last Name
lastname = (xxx ( (('A'..'Z')).join(), 8 ))
testRunner.testCase.setPropertyValue( "LAST_NAME", lastname )
log.info"LastName $lastname"
// This creates a random Date of Birth
def dobyear = (1960 + random.nextInt(31))
def xmonthx = random.nextInt(13)
def xdayx = random.nextInt(31)
xmonthx = ( xmonthx < 10 ) ? "0" + xmonthx : "" + xmonthx
xdayx = ( xdayx < 10 ) ? "0" + xdayx : "" + xdayx
dob = (xmonthx + '-' + xdayx + '-'+ dobyear)
testRunner.testCase.setPropertyValue( "DOB", dob )
log.info"DateofBirth $dob"
// This creates a random Identification Number
identid = xxx ( (('A'..'Z')+('0'..'9')).join(), 9 )+ 'ASAPDL'
testRunner.testCase.setPropertyValue( "IDENT_ID", identid )
log.info"IdentificationNumber $identid"
// This creates a random Identification State
def idstate = random.nextInt(state.size())
testRunner.testCase.setPropertyValue( "ID_STATE", idstate )
log.info (state [idstate])
// This creates a random Identification Issue Date
def idissueyear = (2008 + random.nextInt(5))
def ymonthy = random.nextInt(13)
def ydayy = random.nextInt(31)
ydayy = ( ydayy < 10 ) ? "0" + ydayy : "" + ydayy
ymonthy = ( ymonthy < 10 ) ? "0" + ymonthy : "" + ymonthy
identissue = (ymonthy + '-' + ydayy + '-'+ idissueyear)
testRunner.testCase.setPropertyValue( "IDENT_ISSUE", identissue )
log.info "IdentificationIssueDate $identissue"
// This creates a random Identification Expiration Date
def idexpireyear = (2013 + random.nextInt(5))
def zmonthz = random.nextInt(13)
def zdayz = random.nextInt(31)
zmonthz = ( zmonthz < 10 ) ? "0" + zmonthz : "" + zmonthz
zdayz = ( zdayz < 10 ) ? "0" + zdayz : "" + zdayz
identex = (zmonthz + '-' + zdayz + '-'+ idexpireyear)
testRunner.testCase.setPropertyValue( "IDENT_EX", identex )
log.info "IdentificationExpirationDate $identex"
If I comment out the testRunner method everything works fine, when I try to use it, with many variations, I get the following error.
groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.setPropertyValue() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [ID_STATE, 44] Possible solutions: setPropertyValue(java.lang.String, java.lang.String), getPropertyValue(java.lang.String) error at line: 49