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.

Both - Traffic Object - What is the input?

jefftuckerbofa Posts: 163

When adding an extension tool for scripting, what is the actual input if I select Both - Traffic Object? Is that the entire request and response?



  • williammccusker
    williammccusker Posts: 621 ✭✭✭


    From a quick inspection of the two arguments passed into the script it appears that the first is a "map" and the second is the "context"

    Using the example below these are the following keys in the map that point to various different objects
    Request HTTP Headers
    Request MIME
    Response HTTP Headers
    Response MIME
    Test Name
    XML Request
    XML Request Time in Nanoseconds
    XML Response
    XML Response Time in Nanoseconds

    This is the code that was used to check what the argument types are

    import com.parasoft.api.Application
    def checkClass(one, two) {

    map = one
    map.each{ key, value -> Application.showMessage(key) }

  • jefftuckerbofa
    jefftuckerbofa Posts: 163

    Would it be possible to capture the Request components, swap out the host and port and then forward the request using Groovy (similar to how the Message Forward client works) ?


  • jefftuckerbofa
    jefftuckerbofa Posts: 163

    I had a HUGE ah-ha! moment today WRT scripting. I just figured out how important it is to write script in VAs on your local server and monitor the Console using the available tools, especially Application.showMessage(). This opens up a whole new world WRT scripting. I have already written the code to do what I asked in my question above. Very nice product you have in Virtualize.

  • williammccusker
    williammccusker Posts: 621 ✭✭✭

    Yes! Developing the script locally makes it so that you can see all those print/show message statements which I also have found very helpful.