How to save specific data from response data to csv file

前端 未结 3 1872
说谎
说谎 2021-01-21 19:09

In my webservices test plan, I am sending SOAP request to create user and it sends back username and unique id in the response data. I want to save that username and uniqueid in

3条回答
  •  北海茫月
    2021-01-21 19:22

    You can extract data using Regex post processor and save it to a variable.

    Simple data writer, Flexible data writer, Save results to a file all these can write predefined variables, responses to a file in a fixed or little bit customizable format but won't let you write your custom variables.

    For writing it to a file you need to use Beanshell processor. Sample code would be,

    username = vars.get("username");
    password = vars.get("password");
    
    f = new FileOutputStream("/path/user_details.csv", true);
    p = new PrintStream(f); 
    this.interpreter.setOut(p); 
    print(username + "," + password);
    f.close();
    

提交回复
热议问题