Forum Discussion

Testimonyman's avatar
Testimonyman
New Contributor
11 years ago

Comparing excel values to response properties

Hi all,

I am trying to compare values I read from an excel by a data source step to a property list response.
There response contains <code> property in multiple SubPlanDto sections.
What I am doing is sending the list request for each code value in the excel and asserting it with each code property in the response, so its quite a long process of comparison and the results are not that easy to understand.
What is the best way to approach it and get clear results that code x from the excel matched code y from the response?

Thanks,
Regards,
Adi

2 Replies

  • Ok, some update, I was able to add an array to a groovy script containing the entries I had in an excel so basically e.g
    def MAX_SIZE = 31
    def myArray = new Object[MAX_SIZE]

    // Code array
    myArray[0] = "EU1234qSP"
    myArray[1] = "ES1234qSPwe"
    myArray[2] = "EF1234qSPde"
    myArray[3] = "EW1234qSPpt"

    Then I have expanded the properties Xpath from the web service response that returns the code from the data base. e.g:

    def OfferCode1 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[1]/SubsPlanCode[1]}' )
    def OfferCode2 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[2]/SubsPlanCode[1]}' )
    def OfferCode3 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[3]/SubsPlanCode[1]}' )
    def OfferCode4 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[4]/SubsPlanCode[1]}' )

    What is the best approach to compare them and print that there is a match or fail?
    A loop? or any other way?
    still a beginner at this, can anyone help?

    Cheers
    Adi