IBM Application Runtimes Come for answers. Stay for best practices. All we’re missing is you. Join / Log in Ask a question
HiI am using Rational Performance Tester, and I have 2 services in Json: service A and service B.The service A's response gets a Token, and I want to pass that token as an authentication (Bearer Token) for the service B, how can i do it?#RationalPerformanceTester #Rational #json
You can set the token in the first service test to a variable.1. Highlight the token, right click and create a reference.2. Create a varialbe in the Variables section and make sure it is of scope user.3. Add a variable assignment to the test for your declared variable and assign the variable to the reference you created.4. In your second test declare the same variable of type user.5. Go to the place in your second test where you want to use the token, highlight it, right click and say substitute from->variable name.This should get you going. If you run into problems please feel free to open a support ticket.
The screenshots are from recording. The details on how to pass the token during recording will be specific to your application. For playback, you could pass the token between two tests by 1) Extracting the returned token using a data correlation reference; 2) Add a test variable to your test and assign it a value from the reference; 3) Substitute the recorded token with the variable.
Make sure that you have a Request Header as "Authorization" on Service B. If not, click on Add and then add type Authorization, value should be Bearer "token response from service A". Once added, you can now correlate the value for run time.
Hope it helps !