cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
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
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.

 

 

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 Technical Writer
________________________
Vote up helpful replies.
Accept this reply if you think it's the best solution to your question.
5 REPLIES 5
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.

 

 

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 Technical Writer
________________________
Vote up helpful replies.
Accept this reply if you think it's the best solution to your question.
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.

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?

 

 

 

 

 

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: