Forum Discussion

Aneesha's avatar
Aneesha
New Contributor
8 years ago

How to assert response in Raw Tab

I have been trying to create an assertion for raw response.I need to check whether "openCashDrawer" is present or not in the below raw response.

 

Link: <.>;rel=nextAction;action=openCashDrawer;callOrder=1,<http://10.23.210.96:8090/omnistore-services/rest/receipt/v1/transaction>;rel=nextAction;action=printTxnReceipt;callOrder=2

 

Below is the piece of code which i tried:

 

def expectedCon = '<.>;rel=nextAction;action=openCashDrawer;callOrder=1,<http://10.23.210.96:8090/omnistore-services/rest/receipt/v1/transaction>;rel=nextAction;action=printTxnReceipt;callOrder=2'
def headers = messageExchange.response.responseHeaders
def actualCon = headers['#Link#']
assert expectedCon.size() == actualCon[0].startsWith(expectedCon),"action=openCashDrawer"

 

 

 

1 Reply

  • Lucian's avatar
    Lucian
    Community Hero

    Hey,

     

    If you want to check that the raw response contains a certain string you can simply add a 'Contains' assertion.