cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a property checkpoint for hard code value & a variable

SOLVED
Highlighted
Contributor

How to create a property checkpoint for hard code value & a variable

Hi, I am trying to create a property checkpoint for a 'WndCaption' property. Value should always match to "Last Visit 9/10/2015 (0 days ago)". Here date value may change and even the number 0 may change depending on the test case. I have tried using wild characters like "Last Visit * (* days ago)". But it's not working. Any suggestion please. Also is there anyway I can make sure date is today's date? I am using keyword testing. Any help is appreciated. Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Hero

Re: How to create a property checkpoint for hard code value & a variable

the string you want to use as a baseline will look something like this:

 

"Last Visit " + aqDateTime.Today() + " (" + myvariablefornumberofdays + " days ago)"

 

Instead of using a Property Checkpoint, build your own with an If Then.  See attached screenshot.

 

 

View solution in original post

Highlighted
Moderator

Re: How to create a property checkpoint for hard code value & a variable

What @Marsha_R said, but with two notes:

 

1) You may need to format the date using aqConvert.DateTimeToStr or aqConvert.DateTimeToFormatStr.


2) No need for If...Then -- you can use variables in checkpoints directly. First, create a checkpoint with the hard-coded value first. Then click the checkpoint's Value string, press F2 and replace the hard-coded value with a variable.

 

property-checkpoint-with-variable.png


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

Re: How to create a property checkpoint for hard code value & a variable

the string you want to use as a baseline will look something like this:

 

"Last Visit " + aqDateTime.Today() + " (" + myvariablefornumberofdays + " days ago)"

 

Instead of using a Property Checkpoint, build your own with an If Then.  See attached screenshot.

 

 

View solution in original post

Highlighted
Moderator

Re: How to create a property checkpoint for hard code value & a variable

What @Marsha_R said, but with two notes:

 

1) You may need to format the date using aqConvert.DateTimeToStr or aqConvert.DateTimeToFormatStr.


2) No need for If...Then -- you can use variables in checkpoints directly. First, create a checkpoint with the hard-coded value first. Then click the checkpoint's Value string, press F2 and replace the hard-coded value with a variable.

 

property-checkpoint-with-variable.png


Helen Kosova
SmartBear Documentation Team Lead
________________________
Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

Highlighted
Community Hero

Re: How to create a property checkpoint for hard code value & a variable

We got away from using Property Checkpoints because they slowed our tests down considerably.  If Then runs a lot quicker even if it has more code than just an log message.

Highlighted
Contributor

Re: How to create a property checkpoint for hard code value & a variable

 

Thanks Helen Kosova and Marsha for your help,

 

There is one more issue with month, I am using below code

 

"Last Visit "+ aqConvert.DateTimeToFormatStr(aqDateTime.Today(),"%m/%d/%Y") +" (0 days ago)"

 

I am getting expected value of month as "09" but it should be only "9"

Actual value "Last Visit 9/16/2015 (0 days ago)"
Expected value "Last Visit 09/16/2015 (0 days ago)"

 

what type of format I should use?

 

 

 

 

 

Highlighted
Contributor

Re: How to create a property checkpoint for hard code value & a variable

Found the solution, by adding # flag (%#m) precedes the specifier, the leading zeros are removed from the number.

 

code should be somethign like this

"Last Visit "+ aqConvert.DateTimeToFormatStr(aqDateTime.Today(),"%#m/%d/%Y") +" (0 days ago)"

 

Thanks for all your help

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!
Top Kudoed Authors