Every time you run the below program, a random first name and last name is generated by function using com.thedeanda.lorem.Lorem
def stringBody = """
{
"first_name": "${randomData.TestDataGenerator.getRandomFirstName()}",
"middle_name": "${randomData.TestDataGenerator.getRandomLastName()}",
"last_name": "API",
"date_of_birth": "12/12/2000"
}
"""
println stringBody
===OUTPUT===
My requirement is to read data from Variable.txt file & execute the methods
Variable.txt (202 Bytes)
I am using the below code to read the txt file
import java.nio.charset.StandardCharsets as StandardCharsets
import org.apache.commons.io.FileUtils as FileUtils
File file = new File('C:/Users/NaMohammed/Desktop/Variable.txt')
String content = null
try {
content = FileUtils.readFileToString(file, StandardCharsets.UTF_8)
}
catch (IOException e) {
e.printStackTrace()
}
println(content)
XXX = OUTPUT = XXX