Forum Discussion

AAB's avatar
AAB
Regular Contributor
6 years ago

ReadyAPI- How to assert 2 test runs based on date in response?

Hello,

As our project is evolving fearcely I'm now on a crossroad to assert that my response from the new run is updated with the latest version of the third party. Some explanations:

Testrun1: Response comes from our environment in JSON format that was filled through ETL with an image from a third party. It should contain a 'PDCMetaData' (wrong notation in the screenshot) and a 'PDCData' node (with content that differse for each project). In the 'PDCMetaData' there's a DateTime stamp in 'authorityProcessingDateTime' that shows e.g. 31/12/2018

It should look something like this:

TestRun2: A new version was uploaded through ETL to our environment and the DateTime in 'PDSMetaData' is now 31/12/2019. How can I assert that this date is changed and shows me that a new version is present?

 

Could anybody give me an idea please?

Thanks in advance,

Kind Regards,

AboveAndBeyond

  • richie's avatar
    richie
    Community Hero

    Hey AAB 

     

    dunno whether I can help - but I'm responding cos no-one else has yet.

     

    im a bit lost on this one cos Im not understanding what the problem is - it feels fairly straightforward (and normally your questions are a lot more difficult to answer) which leads me to believe Im really not understanding!

     

    the way I read this is that you have had a new build of code and the date attribute value has altered and you want to assert that it is 31/12/2019 rather than 31/12/2018 - cos that seems straightforward - just use a contains or not contains assertion.

     

    as I say above - normally your questions make me think - so I must not be understanding what the problem is....????

     

    cheers,

     

    rich

     

     

    • AAB's avatar
      AAB
      Regular Contributor

      Hello Richie,

       

      Thanks for your time and answer.

      It is almost straightforeward but not completely. As I don't know when the new update will be, the assertion needs to notice this on it's own. I don't know per definition if every update from third party will be at the end of the year. It could be in July or January for that matter. This was just a first step for me to maybe be able to find something suitable for my case. This was actually an example. I had some thoughts to find it like in the 'SetupScript' for a check if that day has changed. If yes, continue all the automated tests. if the date hasn't change, don't execute the tests.... or something like that. 

       

      Cheers!