Ask a Question

Passing a manipulated date to a keyword test in TestComplete

SOLVED
Alleyn
Contributor

Passing a manipulated date to a keyword test in TestComplete

Forgive me if this is covered already somewhere but I couldn't find the solution. I will try outline the problem:

 

I have a date on a field into which I want to place todays date - 10 years

I have a script that will generate this value for me

 

My question is how or where do I call this script value so that the date field  populates with this new date value? 

3 REPLIES 3
Marsha_R
Champion Level 3

In keyword tests you can use Code Snippet to use a script call and you would assign the value from the script to the field where you want it.

 

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/test-actions/run-code-snip...

hkim5
Staff

1. make sure that the script generates the desired date == returns that date output as a result of running the script routine (probably as a string data type)

2. drag that script routine into your keyword test

3. drag in an "on screen action" into the keyword test workspace immediately below the "run script routine" 

 3.1 Follow the new pop up window to "drag&drop" or "ctrl-shift-a" select the on screen element where you wish to input the date

 3.2 You will probably want to use the "SetText" or "Keys" operations to input the desired date into your desired on screen element. (over simplified explanation: Keys == actual key presses, whereas SetText == literally sets the text)

 3.3 Now you need to provide the value that you want to either "SetText" or "Keys" - should be by default set to Constant Text mode, but you can edit this to be "Last Operation Result"  (select the three dots on the farthest right hand side of the value panel, click around until you see that option).

 

Best,
Justin Kim

Thanks to you both for this. It has helped a lot! Much appreciated.

cancel
Showing results for 
Search instead for 
Did you mean: