cancel
Showing results for 
Search instead for 
Did you mean: 

Keyword Tests and Date Functions/Values

SOLVED
Highlighted
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
Highlighted
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
[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

View solution in original post

2 REPLIES 2
Highlighted
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
[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

View solution in original post

Highlighted
Contributor

Re: Keyword Tests and Date Functions/Values

That did it! Thanks!

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!