How to create and write in a CSV file using gatling

Hi , I am a beginner on gatling / scala
So I want to create a CSV file in my scenario and subsequently I want to save the variables in the created file!!

I have already used this method, but I get this error message

//create the csv file
scala.tools.nsc.io.File("/gatling-maven-plugin-demo/src/test/resources/data/response-data.csv").appendAll(“IDCUSTOMER,RANDOMID\n”)

//Save the variables in the csv file

.exec( session => {
scala.tools.nsc.io.File("/gatling-maven-plugin-demo/src/test/resources/data/response-data.csv").appendAll(session(“IDCUSTOMER”).as[String]+","+session(“RANDOMID”).as[String]+"\n")
session}

error Msg :
Caused by: java.io.FileNotFoundException: \gatling-maven-plugin-demo\src\test\resources\data\response-data.csv (Le chemin d’accès spécifié est introuvable)

Please help me

Thanks,

Hi Khadija,

This is how I created my file:

scala.tools.nsc.io.File("…/user-files/data/MMFilteringResult.json").appendAll(eventDetailsJSON+"\n")

The ‘…’ at the beginning of the path is the GATLING_HOME path.