cancel
Showing results for 
Search instead for 
Did you mean: 

Keyword Tests and Date Functions/Values

SOLVED
Highlighted
New 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?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Keyword Tests and Date Functions/Values

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
[Community Expert Group]
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
Extensions available

View solution in original post

2 REPLIES 2
Community Hero

Re: Keyword Tests and Date Functions/Values

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
[Community Expert Group]
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
Extensions available

View solution in original post

New Contributor

Re: Keyword Tests and Date Functions/Values

That did it! Thanks!

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors