Odin Technology - Automated Software Testing

Axe Test Automation Platform

General discussion relating to the Axe Test Automation Platform from Odin Technology

Posts by Odin employees marked:

How to validate data in Array format in AXE Framework

Hi,

I am AXE framework for testing on Web service.My web service returns data in the Array. So How can I validate the Array??

Please assist.

Response of the Web service

s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
      <GetAvailableMOPResponse xmlns="http://MultiChoice.PaymentService/MessageContracts">
        <MethodofPaymentCollection xmlns="http://MultiChoice.PaymentService/ServiceContracts" xmlns:a="http://MultiChoice.PaymentService/DataContracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:MethodofPayment>
              <a:mopKey>CASH</a:mopKey>
              <a:mopDescription>Cash payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>CHEQUE</a:mopKey>
              <a:mopDescription>Cheque Payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>CC-CARD</a:mopKey>
              <a:mopDescription>Credit Card Payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>TT641</a:mopKey>
              <a:mopDescription>Telegraphic Payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>TT324</a:mopKey>
              <a:mopDescription>Telegraphic Payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>TTAGENT</a:mopKey>
              <a:mopDescription>Telegraphic Payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>ACP</a:mopKey>
              <a:mopDescription>ABS Customer Payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>AAP</a:mopKey>
              <a:mopDescription>ABS Agent Payment</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>BRCPT</a:mopKey>
              <a:mopDescription>Bank Receipt Auto</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>ANGBANK</a:mopKey>
              <a:mopDescription>Angola Bank Receipts</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>DIRECT</a:mopKey>
              <a:mopDescription>Direct Debit</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>OFFLINE</a:mopKey>
              <a:mopDescription>Offline Payments</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>MAESTRO</a:mopKey>
              <a:mopDescription>Maestro Debit Card</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>NO MOP</a:mopKey>
              <a:mopDescription>N0 MOP Payments</a:mopDescription>
            </a:MethodofPayment>
            <a:MethodofPayment>
              <a:mopKey>MOBILE</a:mopKey>
              <a:mopDescription>Mobile payment</a:mopDescription>
            </a:MethodofPayment>
        </MethodofPaymentCollection>
      </GetAvailableMOPResponse>
  </s:Body>
</s:Envelope>




Thank you in Advance.
Rahul Ingle Send private email
Thursday, December 20, 2012
 
 
Hi Rahul,

There are various ways you can do this. Ultimately it really comes down to xpath expressions, which can be managed in your Axe object map.

For a quick and simple solution, the default Axe Action Map provides a get(instance) action for output fields (WsOutParameter) in a soap response. This means that in you Axe tests, where you have I assume, objects mapped for Key and Description you can just use get(1), get(2), get(3) etc to retrieve each instance and validate them.

See the AxeHarness section of the Axe Help for more details.

Sam
Sam Warwick Send private email
Friday, December 21, 2012
 
 
Thanks Sam for quick reply.

But the size of array varies when we change the request. so how can I handle that situation??

What will be in the Object map??
Rahul Ingle Send private email
Friday, December 21, 2012
 
 
Hi Rahul,

Surely you will need to be able to predict the length of the output for each test case? i.e. for any given call to the website with a set of data, you tests should know how many elements to expect in the response.

For the solution I proposed above you can use you current object map entries. But they are just xpath - so you can use any valid xpath expression to retrieve the nodes.

Sam
Sam Warwick Send private email
Friday, December 21, 2012
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics