Dynamic Scripted URL from datasource

tsworldtsworld 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

  • jakubiakjakubiak Posts: 644 admin

    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".

  • tsworldtsworld Posts: 14

    @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

  • tsworldtsworld Posts: 14

    @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_parasoftbenken_parasoft Posts: 890 ✭✭✭

    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.

Sign In or Register to comment.