Forum Discussion
nmrao
8 years agoCommunity Hero
Can you please show the structure of test case?
willtestforfood
8 years agoOccasional Contributor
In my test case I have this in the Setup Script:
//Create a new filereader object, using the context variable so it can be used between test components
context.fileReader = new BufferedReader(new FileReader("/Users/test/Documents/test/testdata.csv"))
//Read in the first line of the data file
firstLine = context.fileReader.readLine()
//Split the first line into a string array and assign the array elements to various test case properties
String[] propData = firstLine.split("\\,")
testCase.setPropertyValue("partnerId",propData[0])
testCase.setPropertyValue("honorificPrefix",propData[1])
testCase.setPropertyValue("first",propData[2])
testCase.setPropertyValue("middle",propData[3])
testCase.setPropertyValue("last",propData[4])
testCase.setPropertyValue("honorificSuffix",propData[5])
testCase.setPropertyValue("addresstype",propData[6])
testCase.setPropertyValue("street1",propData[7])My test case has two steps...
1. REST Request with my POST payload
2. groovy script which has the code I pasted above in my previous comment.
The REST Request from Step 1 goes through the data in my testdata.csv file until it reaches the end of the line. What I would like to achieve is record every request and response into a file or files (if not possible).
Thanks again.