Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

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

Options
Kalaikkumaran_M
Kalaikkumaran_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

Comments

  • Kalaikkumaran_M
    Options

    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;
    }

  • williammccusker
    williammccusker Posts: 643 ✭✭✭
    Options

    Hi,
    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_parasoft
    benken_parasoft Posts: 1,231 ✭✭✭
    Options

    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.