Test Data Manager

  • 1.  How to compare 2016-12-14T00:00:00(Queue o/p) and 2016-12-14 00:00:00 (DB o/p)

    Posted Jun 06, 2017 03:13 AM

    Hi Team,

     

    I am having XML Message which have Timestamp in the format : 2016-12-14T00:00:00. Now, this message is getting inserted into DB in the format : 2016-12-14 00:00:00. I want to compare the XML Message and DB Record for this particular column. I am storing it in property filter and doing assertion "Ensure Properties are Equal". For this particular "Timestamp" field alone, i m getting failed.

     

    Kindly suggest me if you come across the solution, how to validate in devTest Tool.



  • 2.  Re: How to compare 2016-12-14T00:00:00(Queue o/p) and 2016-12-14 00:00:00 (DB o/p)
    Best Answer

    Posted Jun 06, 2017 06:45 AM

    Hi,

     

    You can get both the properties in scripted assertion and compare after replacing "-", "T" and ":". Posting sample code below:

     

    timeFromDB = testExec.getStateValue("property1").replaceAll("-","").replaceAll(":","");

    timeFromXML = testExec.getStateValue("property2").replaceAll("-","").replaceAll(":","").replace("T"," ");

     

    if ( timeFromDB .equals(timeFromXML) ){

    return true;

    }

     

    Thanks,

    Sai



  • 3.  Re: How to compare 2016-12-14T00:00:00(Queue o/p) and 2016-12-14 00:00:00 (DB o/p)

    Posted Jun 06, 2017 11:08 PM

    Thanks Sai & Reid Norton. Still, i am getting the Script Assertion as Failed..