Service Virtualization

Expand all | Collapse all

Assertion for Request Header

Jump to Best Answer
  • 1.  Assertion for Request Header

    Posted 05-09-2018 12:17 PM

    Hi Team,

     

    Is there any way to put assertions for Request header and response header for API testing

     

    Ex:MarketID=CA,UK before running the step I would like to validate header contain CA or UK before executing the step.



  • 2.  Re: Assertion for Request Header
    Best Answer

    Posted 05-11-2018 03:13 PM

    Hi Bala,  you can try adding the below assertions for the Request and Response side.

     

    1. Ensure HTTP Header Contains Expression assertion   ( Request validation)

    https://docops.ca.com/devtest-solutions/10-1/en/reference/assertion-descriptions/http-assertions/ensure-http-header-contains-expression

    The Ensure HTTP Header Contains Expression assertion lets you check that a specific HTTP result header contains a field that matches a specified regular expression.

     

    2.   lisa.StepName.http.headers  property should have the  header values. 

    3.   Assertion from an HTTP Response

    https://docops.ca.com/devtest-solutions/10-1/en/using/using-ca-application-test/using-devtest-workstation-with-ca-application-test/building-test-cases/assertions/add-an-assertion/add-an-assertion-from-an-http-response

     

    Hope this helps