Forum Discussion

Raghunandanits's avatar
Raghunandanits
Occasional Contributor
6 days ago

Is it possible to verify the dynamically changing checkpoint in Keyword test

In my project once record is created it will generate a log with current time and date which need to be validated. if it is possible please let us know the solution.

Many Thanks.

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Frequent Contributor

    Hello, I understand your application creates new record with ID string based on current date time (for example YYYYMMDDhhmmssSSS "20250108115133999") and you want to validate that it is the correct value.
    Is that correct? can you provide your string format?

    If my assumptions is correct, you can do that with writing code to generate a string based on current date time, read the record ID value and compare it with the string you generated. The challenge would be the time difference from when the record was created and when you generate your string. To overcome I suggest you skip the seconds and milliseconds, and perhaps also skip the minutes.

    The following documentation can help you https://support.smartbear.com/testcomplete/docs/scripting/working-with/index.html 

    • JDR2500's avatar
      JDR2500
      Frequent Contributor

      I agree with Hassan_Ballan,

      First, the date/string format you get is a big factor.  Without seeing the precise format, we can only speculate.

      Second, checking for the exact time is a recipe for failure in my experience.  As suggested, it would be more robust to skip at least everything after the minutes.  

      Third, a property checkpoint using a regular expression may be the way to go.  That would give you greater flexibility over how you validate the value.  See:  Regular Expressions Syntax | TestComplete Documentation

      Finally, there are aqDataTime methods that will let you extract the portions of the date/time you want and compare them.  See:  aqDateTime Object Methods | TestComplete Documentation

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Are you referring to the tested "value" that's changing which fails the checkpoint?