Ask a Question

How to check a modified time that will differ every time

MarcusBengtsson
Frequent Contributor

How to check a modified time that will differ every time

Hello! So I am trying to check a "Modified" column. Which contains date and time. This one will always be different each time I run the test and create a NEW one.

However.. I want to check the first date, then make modification to the object and save and check that the modified column have been updated. How would I do this?

 

Do I need to use some variable as it is constantly changing? I am not very good at this so would appreciate some help.

5 REPLIES 5
MW_Didata
Frequent Contributor

Could use some more information to understand what you mean,

But i think what you mean is to compare dates

If the date is on screen you could save that to a variable and use aqDateTime.compare,

Then to check if the date equals today compare against aqDateTime.Today.

 

Otherwise here is all the things TC can do with dates:

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqdatetime/methods.html 

I hope this helps.

Hello! Will try to explain it a bit better hopefully.

MarcusBengtsson_0-1675943662528.png

 

In this picture you can see the column "modified". I want TC to "check/save" this and next time I modify I want it to check that this got updated. Aka doesnt compare to the last check/save before. 

 

But I dont know how to make this as this modified will always be changed each time I make a new one.

 

Also I am working with keyword testing atm.

MarcusBengtsson
Frequent Contributor

How would I use the aqDateTime into this? 

MarcusBengtsson_1-1675943864834.png

or will I need to be using scripting instead?

MW_Didata
Frequent Contributor

I wrote this little function but you could also use code snippet,

MW_Didata_0-1675945770780.png

In the next image if you save the date from the column to a variable and assign it to datum1

Then enter aqDateTime.today (as code expression) to datum2

MW_Didata_1-1675946002336.png

I would also take a substring of just the date to not test the time itself, since that is down to ms it makes it hard to compare.

Basically this code checks if date1 = date 2 and returns a result

Keep in mind that the script is written in VBS, however if you check the link I send you before you should be able to get the same code in different languages

MW_Didata
Frequent Contributor

to assign a date to a var you could use 'set var value: Aliases.etc.etc.etc.date.Value  or .Text

then to get just the date and not the time use:

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqstring/substring.html?sb... 

cancel
Showing results for 
Search instead for 
Did you mean: