Forum Discussion

richie's avatar
richie
Community Hero
5 years ago

GetData For Attribute In RAW Request Displays Intermittent Behaviour????

Hi,

 

I'm totally boggled by this - every so often you find a minor defect in ReadyAPI! that makes things feel a little awkward sometimes - but I am TOTALLY pulling my hair out.  I've got a flaky issue where my payloads aren't being dynamically populated properly - but there's another issue that makes it even worse - the GetData function has intermittent behaviour.  I've noticed quite often that when attempting to source attribute values from other requests - manually typing in the dynamic reference doesn't work - I have to use the GetData function - however - the GetData function's behaviour is completely inconsistent.

 

My tests have 2 POSTs followed by a GET

 

The first POST creates the record

The second POST (with the same content but different attribute values) updates the record but picks up unique attribute values from the RawRequest of the first POST)

The GET queries to confirm the updates

 

The problem is the second POST that needs to grab unique identifiers from the RAW of the first POST - it works 'intermittently' at best - sometimes it works, sometimes it doesn't and then the content of the .json payload for those attributes are blank.

 

My .json payload for the second .json is as follows:

 

{
"name" : "${POST_1#RawRequest#$['name']}",
"templateid" : "${POST_1#RawRequest#$['templateid']}",
"status" : 814250002,
}

When submitted the RAW of the request quite often is correct as 

{
   "name" : "1568298220520",
   "templateid" : "4841c17e-fcf7-43cf-b308-005c0b0bcc01",
   "status" : 814250002,
}

but quite often it is generated as 

{
   "name" : "",
   "templateid" : "",
   "status" : 814250002,
}

I've tried manually editing/updating/replacing the attribute values '${POST_1#RawRequest#$['name']}' and '${POST_1#RawRequest#$['templateid']}' in the 'Request' tab - sometimes this works - but quite often it doesn't - i.e. despite the values populating the request payload with no errors - when submitted I get blank attribute values as above.

 

I've noticed - more often than not - I have to use the Get Data function to dynamically populate the request payload with the value reference - if I just type in the dynamic reference it works maybe 50% of the time - so I really need the GetData function to work - but that is problematic too!

 

When I try using the GetData function via the 'Outline' tab or the 'Form' tab - i.e. within the Outline or Form tab I select the name or templateid attribute, right click and select 'Get Data' from the context menu, click on the first step (from which I need to grab the values from the first step's RawRequest data)  as follows:

 

So - at this point I'm expecting a 'Select JSON' window to be generated once the RawRequest in the previous screenshot is generated as follows:

 

In the last 2 hours  - the above 'Select JSON' window has generated in the last couple of mins - for most of those 2 hours I've been selecting RawRequest on the GetData form and the GetData would close populating the attribute values in the request as follows - i.e. the 'Select JSON' window would NOT generate

 

{ 
"name" : "${POST_1#RawRequest}",
"templateid" : "${POST_1#RawRequest}",
"status" : 814250002
}

rather than 

{
"name" : "${POST_1#RawRequest#$['name']}",
"templateid" : "${POST_1#RawRequest#$['templateid']}",
"status" : 814250002,
}

As I say - it's only in the last 10mins that the 'Select JSON' window has been generating - it's already a little flaky - so I really need this 'Select JSON' window to generate!

 

It's similar to another issue when the Select JSON window doesn't generate.

If the user in a say JSONPath Match Content Assertion uses the 'Select Content' button to select an attribute value from the Request or RawRequest of another test step - a list of the test steps in your test along with all the testsuites in your project is generated.

If you select the relevant test step followed by 'RawRequest' - the 'Select JSON' window DOES NOT appear and the value generated in the Expected Result field is '${TestStepName#RawRequest}.

HOWEVER - if after hitting 'Select Content' if you navigate to the relevant test step's RawRequest by going via the TestSuite, then select TestCase, then select TestStep, then select 'RawRequest' - the 'Select JSON' window DOES appear allowing you to select the appropriate value resulting in ${TestStepName#RawRequest#$['attribute']} being generated in the Expected Result field.

 

At least with using the 'Select Content', I've found a guaranteed way to launch the 'Select JSON' window - but I have wasted a couple of hours on this today and it keeps occurring. 

 

Has anyone come across this and found a way around it?

 

I know the issue with the 'Select Content' and only generating the Select JSON window if you go via the TestSuite has been around since I noticed it in about version 2.2 - I've only noticed this issue with the Select JSON window not appearing in v2.6 and 2.7 - but i don't think I really tried selecting attribute content this way in previous versions.

 

Very, very frustrating - especially with the other behaviour thats flaky too!

 

hahaha! - just as I was finishing this post - the behaviour has reverted - I can no longer generate the Select JSON window anymore!!!!!

 

Thanks guys

 

rich

 

 

if you just select the test step and the Raw Request that is a

2 Replies

    • richie's avatar
      richie
      Community Hero
      Hey Tanya,

      Yeah i was thinking that myself. I was going through previous posts last night and someone else posted this issue on v2.7.0 about 4 or 5 pages back on the forum.

      Cheers,

      Rich