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.

Dynamic Scripted URL from datasource

Options
tsworld
tsworld Posts: 14

In SOAtest9.9
How do I script the URL/endpoint to create REST endpoint dynamically by concatenating values from writable datasource columns. The test should be able to run post request for each data row.

Answers

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    You would just concatenate the references to the columns in the URL file, something like "http://${host}/${path}" assuming that your data source had two columns named "host" and "path".

  • tsworld
    tsworld Posts: 14
    Options

    @jakubiak but script is a goovy code do I need to return this string from a method and how do you specify the name of the data source along with the column name

  • tsworld
    tsworld Posts: 14
    Options

    @jakubiak @benken_parasoft
    can anyone help me doing it with groovy script as I have to do some data manipulation before putting into the endpoint params

  • benken_parasoft
    benken_parasoft Posts: 1,230 ✭✭✭
    Options

    but script is a goovy code do I need to return this string from a method

    I would avoid using groovy code and follow jakubiak's suggestion. However, if you must script something, you can run your groovy code from an Extension tool. Make sure your script return the desired value. You can chain a data bank to save the return value so you can reference it later (like in REST Client). It is common to chain an XML Data Bank to an Extension Tool. You can search the forum for "SOAPUtil.getXMLFromString" to find scripting examples.

    how do you specify the name of the data source along with the column name

    See Extensibility and Scripting Basics > Accessing Data Sources from Scripts.