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 to access a property variable in a Rest Client URL

rickstag
rickstag Posts: 16
edited May 2019 in SOAtest

I want to access a variable like &{test_env} in a url while doing a GET in a Rest Client Test. The url would look like https://mysite.${test_env}.com where test_env is a property which was created in a parent test suite using context.put("test_env", testEnv). I am including a .tst file that reads an excel spreadsheet in a parent test suite test that uses an Extension Tool (using groovy). It then proves in a couple of other Extension Tools that it can get the property and stores it in a variable and uses the variable in an interpolated string. I then go to the child test suite and try to use the property as a variable like ${test_env} and I have no clue on how to access the variable. I tried in a Test Rest Client but it does not know the variable exists. Any help is apprectiated. I just tried to add the .tst file and the site would not let me using the attach file.

Comments

  • jakubiak
    jakubiak Posts: 813 admin

    I would create a test suite variable, and then set that in your Extension Tool. You can then reference the test suite variable using the ${var} syntax.

  • rickstag
    rickstag Posts: 16

    Thanks for the feedback. Can I read a file and update test suite variables?

  • jakubiak
    jakubiak Posts: 813 admin

    I assume you are asking if you can read a file and update test suite variables in your script? Sure - since it's a scripting language you can do almost anything!