Forum Discussion

richie's avatar
richie
Community Hero
7 years ago

PropertyTransfer Fails when Executing Test But Transfer Runs When Manually selecting it to run...

Hi,

 

I have a PropertyTransfer step that's failing when I execute the test - the value returned when the transfer executes during the test is [Invalid JSON:null]  

 

HOWEVER - if I click on the 'Runs selected Property Transfer' on the relevant property, instead of returning the [Invalid JSON:null] response (like when the test executes), instead the PropertyTransfer is successful - i.e. it captures the values from the response successfully

 

I have the following test step hierarchy

 

 

 

GET1 Request (response includes 'Attribute1')
PropertyTransfer (2 property transfers created - it grabs Attribute1 from Response1, and grabs Attribute2 from GET2 response and saves both attribute values to the Properties step
Properties  (2 properties created, 'Attribute1' and 'Attribute 2'
GET2 Request (response includes 'Attribute2')

 

 

Now - the GET1 and GET2 responses were originally XML - but I added in an 'Accept' = 'application/json' header to both GET requests to change response to JSON because the original response was XML but includes an element <@odata.etag>value<@odata.etag> which is malformed XML (element with the '@' symbol) which results in SoapUI inserting a CDATA tag handler wrapper - which is obviously harder to deal with) so I thought I'd convert the response to JSON so I could transfer and assert on specific values in the response.

 

I'm thinking perhaps my changing the response to JSON could be part of the reason.

 

The following are the responses to the 2 GET requests in JSON

 

 

GET 1

[
   {
      "@odata.etag" : "W/\"4815016\"",
      "whatevs1" : 1,
      "whatevs2" : 1,
      "GUID" : "5ae7c359-e148-4ea2-a4b7-d5500aebe185",
 }
]

GET2

{
   "@odata.context" : "https://whatevs.crm4.dynamics.com/api/data/v9.0/$metadata#GUID(GUID)",
   "value" : [
      {
         "@odata.etag" : "W/\"1569419\"",
         "GUID" : "5ae7c359-e148-4ea2-a4b7-d5500aebe185"
      }
   ]
}

I can see that GET1 response returns a JSON array and GET2 response is a JSON object which contains a JSON array and i don't know if that is the problem???  e

 

When I execute the test, the propertytransfer step runs, and returns [Invalid JSON:null] for both property transfers.

 

Again - just to emphasise -- if I manually execute the propertytransfers, it successfully retrieves those 2 GUID values.

 

Would anyone have ANY idea why it fails when I'm executing the test, but runs fine when I execute the propertytransfers manually via the  'Runs selected Property Transfer' button - it works fine!

 

I am totally boggled and have no idea.

 

I've never seen this before and I suspect its linked to my using the Accept header to switch from XML to JSON responses - but that's just a guess on my part - and even  if thats the case - it still doesn't answer why manually running the propertytransfer works fine - but fails when the test executes!

 

Many thanks for any guidance, hints, tips, etc. anyone can provide! :)

 

Always very grateful!

 

richie

 

    • richie's avatar
      richie
      Community Hero

      Hi nmrao

       

       

      I'm not asking for groovy to do this - I know the groovy will work for this - but the property transfer option should work as well and doesn't - hence the reason I asked.

       

      Ignore the fact that I've used the same responses from my previous post - the problem I'm asking about is totally different.

       

      Why does the propertytransfer fail when the test executes but works when run manually?  <-- I'm asking this because it should work but doesn't - hence its a problem

       

      cheers

       

      richie

      • nmrao's avatar
        nmrao
        Champion Level 3

        Would you please show the property transfer step definition(screen shots if possible )?
        Does it always return in item in the json array?
        Any reason for prefering only Property Transfer?