1

I want to create a CSV file with the dynamic data being generated at the runtime. I am trying by using following method below

  • def randomRoute = "Karate Route_"+random_Number(4)
  • def retailerMobile = "+9233334345643"
  • print retailerMobile
  • print randomRoute
  • def data = {"routeName":'#(randomRoute)', "userMobile":'#(retailerMobile)', "stop":"1"}
  • print data
  • karate.write(data, 'routeRequirements.json')
  • karate.write(data, 'routes.csv')

Anyone have any idea where am I doing it wrong? Was unable to find any perfect solution for this

  • Please clarify what the problem is. From the code I can see that you create json data and write that to a file with '.csv' extension. Maybe you should first take a look at this: https://en.wikipedia.org/wiki/Comma-separated_values – Michael Nov 08 '22 at 12:00

0 Answers0