Forum Discussion

nado's avatar
nado
Occasional Contributor
5 months ago
Solved

check points for changeable values

Hey Guys,

 

I have a question about property checks. During my testing I want to check the date which is always changing from day to day or the name of my document which is also changing according to the date. So which kind of property check I can use for? Or how can I manage it with phyton scripts?

 

Could you pls help me?

  • A good starting point would be to read Checkpoints. Also, see Working With Dates too.

     

    If you have a file called 'Test_20231127.txt', then you can create a function to generate the filename

    currentDate = aqDateTime.Today()
    dateFormat = aqConvert.DateTimeToFormatStr(currentDate, "%Y%m%d")
    fileName = 'Test_' + dateFormat

     which you can then use to perform comparison later

3 Replies

  • nado's avatar
    nado
    Occasional Contributor

    Thank you very much guys, I fixed my problem with your helps😉

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    A good starting point would be to read Checkpoints. Also, see Working With Dates too.

     

    If you have a file called 'Test_20231127.txt', then you can create a function to generate the filename

    currentDate = aqDateTime.Today()
    dateFormat = aqConvert.DateTimeToFormatStr(currentDate, "%Y%m%d")
    fileName = 'Test_' + dateFormat

     which you can then use to perform comparison later

  • nastester's avatar
    nastester
    Regular Contributor

    I have something like this in one of my projects which looks for the file in the Downloads folder and that the filename matches what is expected:

     

    function DownloadFileExists()
    {
        var file = "C:\\Users\\" + Sys.UserName + "\\Downloads\\Text_Messaging_" + 
        aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "%m" + "_" + "%d" + "_"  +"%Y") + ".pdf"
        
        if (aqFileSystem.Exists(file)) {
          
            Log.Message("File exists: " + file);
        
        } else {
          
            Log.Error("File does not exist")
        }
    }