how to save the result of extension tool into variables in Parasoft

Kalaikkumaran_MKalaikkumaran_M Posts: 42
edited September 2019 in Virtualize

Hi Team

I have a JAVA script which generates some numbers once executed using Extension tool. Now I wanted to save the result into some variables/data source. So that I can use those variables in multiple locations.

Note: the same JAVA script I need it for 20-30 times in single response generation. Instead of giving every tags as scripting I wanted to pass the variable once Extension run is completed.

Please help me with the approach


  • Ex: The below is JAVA script which generates 5 digit number(Just an example as I know we have data generator in Place :smile: ) ., I wanted to save this as a variable/data source in Virtualize.

    function makeid()
    var text = "";
    var possible = "0123456789";
    for (var i=0; i<5; i++)
    text += possible.charAt(Math.floor(Math.random()*possible.length));
    return text;

  • williammccuskerwilliammccusker Posts: 392 ✭✭

    You should be able to chain a data bank to the output of the extension tool. In this case it looks like you are returning a string so a text data bank might be the best option.

  • benken_parasoftbenken_parasoft Posts: 890 ✭✭✭

    It is also very common to chain an XML Data Bank to the Extension Tool. You can search the forum for "SOAPUtil.getXMLFromString" to find examples.

    If you haven't done so already, please also take a look at the Data Generator tool which was intended to help avoid cases where you would otherwise have to write a script and chain a data bank.

Sign In or Register to comment.