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 Do I Use a Method Tool to Get Current Value of an Environment

LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest

How do I use a method tool to find out what's the current value for my variable HOST and change it based on a response from a server. For example, I have an Endpoint field http://${HOST}/service. When my SOAP Client hits this URL, the server tells me to go to a different HOST. I'd like to substitue the current HOST with the new one and go to that new server.




  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Hi Brandon,

    Environmental Variables are meant to be static, and so you can't change the environment variable during the test. However, you can use a XML Databank to store values from the XML response. Then you can have your next test parameterize its endpoint using the value stored in the XML Databank.

    If you're not able to get the full path from the server. You can use the method tool to process the value taken from the XML Databank, edit that and save it as a Test Suite Variable. You can set your test suite variables by clicking on the Test Suite Folder node -> Execution Options tab -> Test Variables Tab at the bottom of the Project Configuration. Add a test suite variable and make it string.

    Now you can use your method tool to access the test suite variable. Your SOAP Client can reference the variable as: ${<varName>}.

    I hope this helps,
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited December 2016

    Thanks, Michael! The test suite variable method works.