Forum Discussion

Raghunandanits's avatar
Raghunandanits
Occasional Contributor
5 months ago
Solved

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.

7 Replies

  • 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

       

    • Raghunandanits's avatar
      Raghunandanits
      Occasional Contributor

      Hello Hassan_Ballan,

      This is my date format, which i would like to validate - 02/01/2025 07:05 (dd/MM/YYY hh:mm) will check with the documentation. by the way I am using Keyword test.

      • Hassan_Ballan's avatar
        Hassan_Ballan
        Icon for Champion Level 1 rankChampion Level 1

        Hello Raghunandanits 

        The following example project should get you started and mimic some portions on how I set it up, it contains a keyword test that calls script to generate a sample log date as well as the required string that saves in the project variables LogString and StringDateTime. Also logs the values and does a comparison that fails. 

        Not being familiar with your project is hard to imagine how you are going to use it. But I think you have enough to implement your own design. Open the DateTime.mds file to view the project.

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

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