Forum Discussion

mayankrathi27's avatar
mayankrathi27
New Member
6 years ago

How to automate dynamic token generated by a URL for Rest API in SOAPUI ?

For my project I have created test cases in SOAPUI for Rest project. I have to pass token in header for each test steps that I have added in the test cases.

Also the token validity only for 1 hour. So every hour I have to enter the token in the headers.

I want to know is there any way automate this token entry and generation dynamically ?

For now what I am doing is getting token every time by refreshing the URL in every 1 hour and putting it manually in header of every test case and test steps.

1 Reply

  • JHunt's avatar
    JHunt
    Community Hero

    Each of your test cases should probably involve getting a new token and then using that token, every time you run it. I've put together an example project that shows you how to do this (attached).

     

    The important bit is done in the Assertion on the "Get token" step.