Forum Discussion

LZhang's avatar
LZhang
Frequent Contributor
17 years ago

How to add assertions to responses in a datasource loop?

Hi:

I have a datasource loop in my test case.  Having said that, I would have 3 different responses because I have a loop, e.g,
in the first response, it shows

     
       
            soap:Receiver
       

       
            Server was unable to process request. ---> Invalid Guid value is set for property: DeviceProfileId
       

       
     

 

Second response:

     
       
            soap:Receiver
       

       
            Server was unable to process request. ---> Mandatory GUID property is not specified: DeviceProfileId
       

       
     

 

Third response:
 
       
            cdf9989a-bcf8-4bbd-b1b9-9c6de742e4e6
            c1e9ccff-4a87-4a0e-99e4-4f06a78b5858
            2008-03-03T22:31:30Z
            PNE
           
       

     


Basically, each of my responses is different and I would like to add different assertions in the responses.  Is that a way to do that?

Thanks,
Li Zhang

3 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Li,

    If you are going to assert the entire content of the response you could create a separate datasource containing the assertions expected response; ie create one xpath assertion with the xpath expression selecting the envelope and the expected content set to ${AssertionDataSource#expectedContent}

    (Since you can have only one DataSourceLoop, you need to make sure that the loop actually "passes" the AssertionDataSource for each run so it gets the next row each time)

    Could that be an option?

    regards!

    /Ole
    eviware.com
  • Jsyed's avatar
    Jsyed
    Occasional Contributor
    Hi Ole!
    This is junaid li Colleague. Actually i was trying the suggestion you have given about putting assertion in datasource but i am having trouble doing so. First of all please advise is it possible to have two different type of error in the assertion. Meaning 1 error is soap fault and another one is actual error thrown by the system. I tried and i personally think we can't have soap fault and application error in the same because Xpath will be totally different for both.
    Please advice.

    Thanks
    Junaid
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    both the XPath and expression and the expected content can be specified using property expansion, so you could have a datasource with 2 properties ("xpath" and "content") and then expand them with ${DataSource#xpath} and ${DataSource#content} in the corresponding XPath assertion fields.

    Hope this helps!

    regards,

    /Ole
    eviware.com