cancel
Showing results for 
Search instead for 
Did you mean: 

Using functions in KeywordTest

Highlighted
Contributor

Using functions in KeywordTest

Hello,



how can I return the value of a function to a text box using Keyword Testing?



For example, I have the following function written in javascript that returns a random username :



function random_username()

{

var currentTime = new Date();

var hour = currentTime.getHours();

var min = currentTime.getMinutes();

var sec = currentTime.getSeconds();

var day = currentTime.getDate();

var month = currentTime.getMonth() + 1;

return 'Monthly' + month + day + '_' + hour + min + sec;

}




and I want the returning value to be typed in a textbox from a recorded KeywordTest (see attached image).



Thank you,

Andrei

1 REPLY 1
Highlighted
Staff

RE: Using functions in KeywordTest

Hi Andrei,



You need to use the Run Script Routine operation (see the "Run Script Routine Operation" help topic).

------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors