1

I have previously tested this code on its own, once moving it into my class it breaks and gives me the error.

groovy.lang.MIssingPropertyException: No such property: testRunner for class: csvConsume

class csvConsume {

    static void main(args) {

            def mapList = []
            File csvFile = new File("test.csv")

            csvFile.splitEachLine( /,\s*/ ){ parts ->

                def tmpMap = ""
                if( '1' == parts[ 2 ] || '2' == parts[2] ) {
                tmpMap = [:]
                tmpMap.putAt("id", parts[0])
                tmpMap.putAt("matchkey", parts[1])
                tmpMap.putAt("bureau_type", parts[2])
                tmpMap.putAt("create_date", parts[3])
                mapList.add(tmpMap)
                }

                // etc.

                //reading with new reader and writing output file. 
                        def responseHolder =  testRunner.testCase.testSteps["Request"].testRequest.response.responseContent 
                        def outputFile = "response.csv"
                        def reader = csvFile.newReader()
                        new File(outputFile).append(responseHolder)
                        reader.close()





            }

    }
}
Cylus
  • 11
  • 3
  • The error is obvious. There is no variable `testRunner` in your class. You have to pass/declare it into your class or function. – daggett Oct 03 '19 at 04:57
  • in soapui, when I use external classes for my groovy scripts, I have to change 'testRunner' to 'runner'. try to check the examples SmarteBear provides – A.Joly Oct 03 '19 at 11:01

0 Answers0