Sperk
7 years agoOccasional Contributor
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() log.info(fTime) 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 com.eviware.soapui.support.GroovyUtils(context) 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') log.info('FIRST TIME THROUGH') testRunner.testCase.setPropertyValue("firstIteration", 'false') } // Debugger objecting to this line resultsFile = testRunner.testCase.setPropertyValue("externalResultsFile") // log.info(firstTimeThrough) obj = context.testCase.getTestStepByName("Get-FR-Dealer-Products") assertions = obj.getAssertionList() assertions.each{ stat = (it.status).toString() log.info (stat) if(stat == "FAILED"){ log.info "FOUND FAILED" resultsFile.append(it.name + ' --> ' + 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.