Data source groovy
Hello All,
I currently use this groovy script to load data to my data source in Ready Api
// To get the output value, use the built-in result map object
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def projectPath = groovyUtils.projectPath
def directoryName = projectPath + "/testData"
def row = testRunner.testCase.testSteps["DataSource"].currentRow
def allFiles = []
new File( directoryName ).eachFile() { file ->
if( file.name =~ /.txt/ ) {
allFiles.add( file.name ) }
}
if ( (row + 1) <= allFiles.size ) {
// Output to the test step property called inputData
result["email"] = new File( directoryName + "/" + allFiles[row] ).text
}
It takes emails from a file and puts it all in one row. To make separate entries, I had to put the emails in different text files. How would I change this script to read data from one text file and separate emails into different rows? Thanks.