How to access RestTest Header Values from Traffic view Objects
Hi,
I am new to this forum and I really need help. I have 100 + rest test cases in my suite and I need to retrieve header value from Traffic Viewer Objects for Each Test Cases. Would you please give me a code for this?
Answers
-
Welcome,
You could use a Header DataBank, Text databank, or REST URL databank to extract the desired response header values.
1) Add an output tool to your REST client
2) Select Response> Transport Header and choose the desired databank.3) Run the tool and verify that the databank is populated with information.
Unfortunately, you would need to do this for all your REST clients. If the desire is to do this for all tests in a single run, you could run your clients through a VIRTUALIZE proxy and extract the headers along the way in a single run, but that may be a little more work
0 -
Why do you need to "retrieve header value"? If this is for validation, then you can diff the response header (with Diff tool). You only would use a Data Bank if you need to reuse the extracted header value as input to another test case.
1 -
Thank you for your email and I am looking for code to get the request header value from Traffic viewer Object for my rest clients in my suite.
0 -
Use the Header Data Bank to extract header values. You chain this to the "Response Transport Header" output.
0 -
Thanks for your message and Instead of using header bank. Would you please provide code..
0 -
Can you please clarify why you are looking to write code? Is there some reason why you can't use a Header Data Bank like Omar described in his earlier comment? Omar provided quite a bit of detail, including screenshots.
0 -
Can any one explain the use of diff to validate the response header (with Diff tool).
0 -
An easy way to set this up is to right-click on the REST Client, choose Add Output, choose Response Traffic and choose to add a Diff tool. Then right-click on the REST Client again and select Create/Update Regression Control. This will cause the Diff Tool to get populated with the header content from a run of the test. Response headers often have dynamic data, so when you run it the first time you may have some differences reported due to dynamic data such as the Date header. When that happens, you can right-click on any errors that get reported in the Quality Tasks view that are for dynamic data, and choose the option Ignore Difference. This will set up your Diff Tool to compare the header content, but ignore the lines with dynamic data.
0 -
Also see Creating Regression Tests Using the Diff Tool. This should work for any tool output including "Response > Transport Header".
0