Ask a Question

Keyword Tests and Date Functions/Values

SOLVED
GradyJr
Contributor

Keyword Tests and Date Functions/Values

I'm trying to modify the Value of a Property Checkpoint in a Keyword Test so that it will contain a string of text that remains constant concatenated with a string variable containing the current date in "yyyy\mm\dd" format (yes, I meant to use back slashes). I can create the variable name and I can insert the variable name into the value of the Property Checkpoint. I've tested this by setting the variable name to a hardcoded string value of today's date (see attached image) and it works. But, of course, it won't work tomorrow. I can't seem to figure out how to make that "Set Variable Value" assignment with a date function that results in today's date (IOW, replace "2019/10/22" in the image with something such as "Format(Now(),"yyyy\mm\dd"). Is what I'm describing possible?

2 REPLIES 2
tristaanogre
Esteemed Contributor

When you use the "Set Variable Value" operation, the parameter for the "value" can be set to a "Code Expression".

 

Then you can type out exactly that... a code expression.  I would use a combination of aqConvert.DateTimetoFormatStr and aqDateTime.Now.

 

See 

https://support.smartbear.com/testcomplete/docs/reference/program-objects/aqconvert/datetimetoformat...

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


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

That did it! Thanks!

cancel
Showing results for 
Search instead for 
Did you mean: