Forum Discussion

gk30888's avatar
gk30888
Occasional Contributor
13 years ago

Text Data Source using Groovy error

Hi,

Can anyone help me , What is the actual error on this code ? I'm gave the same test case name in groovy but it is still showing groovy.missingproperty.Property not found.

Code:

import com.eviware.soapui.support.XmlHolder
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )

def folderName = "d:\\data\\532178548\\Desktop\\Samples" //to store the response
def createFolder = new File(folderName)
createFolder.mkdir()

def testSuite = testRunner.testCase.testSuite.project.testSuites["Flights"]
def testCase = testSuite.getTestCaseAt(0)
def testStep1 = testCase.getTestStepCount()

def xHolder = new XmlHolder(testCase.getTestStepAt(0).getProperty("Response").getValue())

File tempFile = new File("d:\\data\\532178548\\Desktop\\Samples\\data_source_file.txt")
List lines = tempFile.readLines()
def i=0
def temp1 = 0
def inputValue
def myTestStep
def myTestRunner
def myTestStepContext
//Loop through all the names of the test steps.
( 0..<testStep1 ).each
{ i=0
tempFile.eachLine
{
testCase.setPropertyValue("inputValue", lines[i++])
inputValue = context.expand( '${#TestCase#inputValue}' )
myTestStep = testCase.getTestStepAt(temp1)
myTestRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(myTestCase,null)
myTestStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(GetFlight)
myTestStep.run( myTestRunner, myTestStepContext )
xHolder = new XmlHolder(testCase.getTestStepAt(temp1).getProperty("Response").getValue())
f = new File( folderName + ‘/’ + inputValue + ‘_’ + testCase.getTestStepAt(temp1).getName().toString() + '.txt')
f.append("\r\n\r\n\r\n\r\n\r\n")
f.append("#################################################\r\n")
f.append("\t\t\t Response \r\n")
f.append("#################################################\r\n\r\n\r\n\r\n\r\n")
f.write(xHolder.prettyXml)
xHolder.clear()

}
temp1++
}


Regards,
- Karthik

4 Replies

  • Finan's avatar
    Finan
    Frequent Contributor
    Without the project / testCase and you didn't provide the exact error, it is hard to determine which property is missing....

    My guess would be the following line:

    xHolder = new XmlHolder(testCase.getTestStepAt(temp1).getProperty("Response").getValue())

    Are all the testSteps returning XML's ?

    or:
    myTestStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(GetFlight)

    Where did you define GetFlight?
  • gk30888's avatar
    gk30888
    Occasional Contributor
    Hi,

    myTestRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(myTestCase,null)


    My Testcase name is myTestCase. But it is showing error in that.


    Regards,
    - Karthik
  • gk30888's avatar
    gk30888
    Occasional Contributor
    Hi Ole,

    We are using your pro version also. Need your support for this. Please solve the problem




    Regards,
    - Karthik
  • Finan's avatar
    Finan
    Frequent Contributor
    I see 2 properties that are not defined (at least not in this script)
    myTestCase and GetFlight

    Script executes for me, if I replace those properties or define them.