cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate a dynamic value each test

SOLVED
Highlighted
New Contributor

Calculate a dynamic value each test

Hi there!

 

I would like to use a variable which should be calculated each test. 

For example, I would like to use a particular date (e.g. 01.05.2019).

I choose the "Keys" operation and set 01.05.2019 as Value. 

Next time I want to use another value (e.g. 01.06.2019) but it should be updated automatically. 

 

How can I set a rule to update my current value automatically and add one month each test like:

 

Thank you in advance!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Calculate a dynamic value each test

Hi,

 

Something like this (untested pseudocode):

var strDT = aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Now(), 1), '%d.%m.%Y');

<control>.Keys(strDT);

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

4 REPLIES 4
Highlighted
Community Hero

Re: Calculate a dynamic value each test

Hi,

 

Something like this (untested pseudocode):

var strDT = aqConvert.DateTimeToFormatStr(aqDateTime.AddMonths(aqDateTime.Now(), 1), '%d.%m.%Y');

<control>.Keys(strDT);

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
New Contributor

Re: Calculate a dynamic value each test

Thanks for the feedback!

 

Could you advise how a code which generates the required variable could be implemented in a KeywordTest?

Currently, I do not use scripts so I'll appreciate any assistance regarding the matter.

 

Highlighted
Community Hero

Re: Calculate a dynamic value each test

Highlighted
Contributor

Re: Calculate a dynamic value each test

You can also change the type of text you want to type from Constant~String to Code Expression.

 

[See attached]

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!