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.

Scripting with a value in a XML Databank chained to Request

Options

I am trying to access a value stored in a XML data bank that is chained to the incoming request. In my extension tool, I chained a XML data bank to see if I can successfully pass the value to the tool.

my code:

function f(input, context){
var id = context.getValue("Generated Data Source","traceId");

return id;

}

My issue is that the data bank is always blank when I run the tests and hit the response. The extension tool is linked as Traffic Object -> Extension tool.

What am I missing here?

Comments

  • jakubiak
    jakubiak Posts: 805 admin
    Options

    When you say the "data bank is always blank", I assume you are referring to the UI for the XML Data Bank when you open the tool? If so, you are correct that the XML Data Bank does not populate with content after you hit a virtual asset. In order to populate it, you need to copy an example payload into the expected content field of the data bank, and then the UI controls will be there to help you define an XPath for extracting an element.

  • VirtEyes
    VirtEyes Posts: 62
    Options

    That is the case i am talking about, the data bank appears to have no traffic or values to extract.
    So is XML data bank the wrong tool to store the value generated from the extension tool?

  • jakubiak
    jakubiak Posts: 805 admin
    Options

    No, it's the right tool - you just need to manually populate the tool with the expected content to make it easier for you to define the XPaths that you need. Once you have the tool configured, it will actually execute when a request is made to the corresponding responder.

  • VirtEyes
    VirtEyes Posts: 62
    Options

    What should I do in the instance that the extension tool sets a value that takes a value from a value in the request, but sets the value of a variable that only exists in the response?

    I have tried your suggestion, but the databank doesn't seem to pass that value from the extension tool to the response

  • williammccusker
    williammccusker Posts: 651 ✭✭✭
    Options

    Hi,
    I think this case sounds more complicated that we understood it to be. Could you contact support@parasoft.com so that someone can help you directly with your issue?