Forum Discussion

Sperk's avatar
Occasional Contributor
7 years ago

Writing to a file where the filename is held in a TC property

When looping through a Datasource and parsing Rest requests I'm trying to create a file on the 1st iteration and write to that file on all iterations.


I'm storing the file name in a TC property and when debugging the code it is objecting to the line highlighted below saying I cannot write to the file defined like this.


I'm a Groovy noob so any help would be really appreciated


def firstTimeThrough = testRunner.testCase.getPropertyValue('firstIteration')

fTime = firstTimeThrough.toBoolean()

if(fTime == true){
	def date = new java.text.SimpleDateFormat("yyyy-MM-dd-HH-mm-SS")
	def fname = 'FRDealerResponseFile_' + date.format(new Date())
	def groovyUtils = new
	def projectPath = groovyUtils.projectPath
	def resultsFile = new File(projectPath + '\\Results\\FR-Dealer-Get-Products\\' + fname + '.log')
	testRunner.testCase.setPropertyValue("externalResultsFile", projectPath + '\\Results\\FR-Dealer-Get-Products\\' + fname + '.log')
	testRunner.testCase.setPropertyValue("firstIteration", 'false')
	testRunner.testCase.setPropertyValue("overallResult", 'PASSED')'FIRST TIME THROUGH')
	testRunner.testCase.setPropertyValue("firstIteration", 'false')

// Debugger objecting to this line
resultsFile = testRunner.testCase.setPropertyValue("externalResultsFile")

obj = context.testCase.getTestStepByName("Get-FR-Dealer-Products")
assertions = obj.getAssertionList()
stat = (it.status).toString() (stat)
   if(stat == "FAILED"){ "FOUND FAILED"
	resultsFile.append( + ' --> ' + it.status)
	res = 'FAILED'

Here is the error message returned by the debugger


groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlTestCasePro.setPropertyValue() is applicable for argument types: (java.lang.String) values: [externalResultsFile] Possible solutions: getPropertyValue(java.lang.String), setPropertyValue(java.lang.String, java.lang.String) error at line: 21

Mark Smith



  • "setPropertyValue" - requires two inputs; one for property name and another one is for its value.

1 Reply

  • nmrao's avatar
    Champion Level 3
    "setPropertyValue" - requires two inputs; one for property name and another one is for its value.