Contributions
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.495Views0likes1CommentReady API datasource with groovy error
Hello All, I am having the following error when I run this groovy script for my datasource in readyapi: Error in datasource script of Data source. Cannot get property of "current row" on null 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 } Could someone please help me with this. Thanks.Solved741Views0likes2Comments