ContributionsMost RecentMost LikesSolutionsRe: Property Expansion not working in 'File Wait' step in ReadyAPI This is a bug in Ready API that Property Expansion not working for "FileWait" test step. I've created a separate ticket and SmartBear is working on it (RIA-3179). Groovy to delete all the files in a directory Can someone direct me how to delete all the files in a directory.. (As a prerequisite, this needs to be done before running each testcase) I've googled it and couldn't get the relevant answer. I tried with following snippet def del = FileUtils.cleanDirectory(filePath) But this is not working! Getting MissingPropertyException message! SolvedRe: Property Expansion not working in 'File Wait' step in ReadyAPI The code which i used is just to ensure whether my Property Expansion refers the correct value. And, there is no space in the filename/directory and the file exists there. I'm not getting the point "Use file path separator "/" even on windows." I tried with "/" separator as well,. Still failing One more thing i've tried.. Adding another Property (Actual) in the Property step. Given the entire filepath (\\ldvdevinvrt01\resources\Sharepipe\CC8F5797-8CB5-4175-A564-781A5DA76221.txt). Now, accessing this in File Wait step using ${TC Properties#Actual}. Failing for this as well. Re: Property Expansion not working in 'File Wait' step in ReadyAPI Nope :smileysad: still failing.. TC Passes with the hardcoded value (Y:\Sharepipe\CC8F5797-8CB5-4175-A564-781A5DA76221.txt) Re: Property Expansion not working in 'File Wait' step in ReadyAPI I edited the FilePath value in Properties by adding separator(\\ldvdevinvrt01\resources\Sharepipe\) . Still it is failing.. Executed this below groovy and got the correct FilePath value def path = context.expand('${TC Properties#FilePath}${TC Properties#Transaction_ID}.txt') log.info path Output Returned: \\ldvdevinvrt01\resources\Sharepipe\CC8F5797-8CB5-4175-A564-781A5DA76221.txt While giving this output value in FileWait step, TC passes. Problem is with Property Expansion. Property Expansion not working in 'File Wait' step in ReadyAPI I have a Property step in my Testcase holds 2 values as shown below After some internal processing a file will be stored in the FilePath with the filename Transaction_ID. I'm trying to validate the file using "File Wait" step in my testcase using Property Expansion ${TC Properties#FilePath}${TC Properties#Transaction_ID}.txt Upon running the testcase, it is failing due to the reason "File not found within specified timeout". Whereas, i've hardcoded the filepath value as \\ldvdevinvrt01\resources\Sharepipe\CC8F5797-8CB5-4175-A564-781A5DA76221.txt and provided in the 'File Wait' step. Then it is executing successfully without any error. Please someone help out with this! PS: Took this hardcoded value using Groovy by printing the Property Expansion value mentioned above. I believe no issues in Property Expansion syntax Re: Getting MissingMethodException while calling Groovy class in a script The script mentioned above is the one which I'm using to print TransactionID.. wanted to convert that into reusable Groovy class.. Guessing that there would be error in creating the object to call the Groovy class Getting MissingMethodException while calling Groovy class in a script Below is the groovy script which I would like to convert into reusable Groovy class def resp = context.testCase.getTestStepByName(retrieveSequenceNumberAfter).getPropertyValue("ResponseAsXml") def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder(resp) def transid = holder.getNodeValue("Results/ResultSet/Row/transaction_id") log.info transid I've created a Groovy class library with the method validatetransid as in following code in it: package com.Linos.readyapi.util.trans.transaction class TransactionID { def context def log def validatetransid(String stepName) { def resp = context.testCase.getTestStepByName(stepName).getPropertyValue("ResponseAsXml") def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder(resp) def transid = holder.getNodeValue("Results/ResultSet/Row/transaction_id") log.info transid } } I'm trying to create the object of class and use the methods anywhere in the SoapUI projects as below: define transid = new TransactionID(context:context, log:log) transid.validatetransid('retrieveSequenceNumberAfter') With the above code, I'm getting the following exception.. Please advise where my code goes wrong? groovy.lang.MissingMethodException: No signature of method: Script17.define() is applicable for argument types: (com.Linos.readyapi.util.trans.transaction.TransactionID) values: [com.Linos.readyapi.util.trans.transaction.TransactionID@228bb11d] Possible solutions: find(), find(groovy.lang.Closure), print(java.lang.Object), main([Ljava.lang.String;), print(java.lang.Object), print(java.io.PrintWriter) SolvedHow to place the Groovy in centralized Groovy Library and access that class from any script I have the below Groovy script which i need to place it in centralized Groovy Library and then access the class mentioned in the Groovy from any script in my Ready API Project. //Change the name of the Properties test step below def step = context.testCase.testSteps['Properties'] //Parse the xml like you have in your script def parsedXml = new XmlSlurper().parse(file) //Get the all the error details from the response as map def errorDetails = parsedXml.'**'.findAll { it.name() == 'IntegrationServiceErrorCode'}.inject([:]){map, entry -> map[entry.ErrorCode.text()] = entry.Description.text(); map } log.info "Error details from response : ${errorDetails}" def failureMessage = new StringBuffer() //Loop thru properties of Property step and check against the response step.properties.keySet().each { key -> if (errorDetails.containsKey(key)) { step.properties[key]?.value == errorDetails[key] ?: failureMessage.append("Response error code discription mismatch. expected [${step.properties[key]?.value}] vs actual [${errorDetails[key]}]") } else { failureMessage.append("Response does not have error code ${key}") } } if (failureMessage.toString()) { throw new Error(failureMessage.toString()) } Path: D:\GroovyLib\com\Linos\readyapi\util\property\propertyvalidation File Name: PropertyValidation I have just tried the code in Groovy Library.. Please correct this if wrong package com.Linos.readyapi.util.property.propertyvalidation import com.eviware.soapui.support.GroovyUtils import groovy.lang.GroovyObject import groovy.sql.Sql class PropertyValidation { def static propertystepvalidation() { //Change the name of the Properties test step below def step = context.testCase.testSteps['Properties'] //Parse the xml like you have in your script def parsedXml = new XmlSlurper().parse(file) //Get the all the error details from the response as map def errorDetails = parsedXml.'**'.findAll { it.name() == 'IntegrationServiceErrorCode'}.inject([:]){map, entry -> map[entry.ErrorCode.text()] = entry.Description.text(); map } log.info "Error details from response : ${errorDetails}" def failureMessage = new StringBuffer() //Loop thru properties of Property step and check against the response step.properties.keySet().each { key -> if (errorDetails.containsKey(key)) { step.properties[key]?.value == errorDetails[key] ?: failureMessage.append("Response error code discription mismatch. expected [${step.properties[key]?.value}] vs actual [${errorDetails[key]}]") } else { failureMessage.append("Response does not have error code ${key}") } } if (failureMessage.toString()) { throw new Error(failureMessage.toString()) } I am not sure what to mention in the def static method. I am new to this process and haven't done that yet. Can someone please guide me! I've read the documentation on Ready API! website. But I'm not clear on that. SolvedRe: How to place the Groovy in centralized Groovy Library and access that class from any script yes.. this is the documentation which i read.. not clear in that.. doesn't have detailed information i felt Edited my post..