Search code examples
automationsoapuiaccess-token

How to automate access token in soap ui


I have created test cases in soap ui. I have to pass access token for each test steps and have added it.

I want to know is there any way to pass access token dynamically? For now what I am doing is getting access token every time by running login POST request and put manually in header of every test case and test steps.

I know that there is project level properties can by used but still it require one time manual to get access token and put in project level properties. I want to automation it like each time login test case run automatically and generated access-token should apply for all test cases.


Solution

  • You can automate the whole process:

    1. Make a POST request to get the access token.

    2. Use a Property Transfer test step to assign the token value to a project property (e.g. myProperty).

    3. Use the project property in your requests as:

      ${#Project#myProperty}

    You can put this string into your JSON/XML, into HTTP headers or other places -- where you need it.