How Do I Use a Method Tool to Get Current Value of an Environment

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
Hi,

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.

Thanks,

Brandon
Tagged:

Comments

  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    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,
    Michael
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    edited December 2016

    Thanks, Michael! The test suite variable method works.

    Regards,

    Brandon
Sign In or Register to comment.