Hi
I'm trying to create a random user name in my tests in this format: tYYYYMMDDHHMM
I tried to do this with an external excel file that convert the "=NOW()" to this string and it works - only for the first time (even If I adding the excel file to the project).
I want to do this thing in the ranorex code but I don't know where to put it and how (how to write the code).
I will appreciate if someone can help me to do it.
Need a snippet to create user name randomaly
Re: Need a snippet to create user name randomaly
Hi,
Try this...
Try this...
string DateStr = DateTime.Now.ToString("yyyyMMddHHmmss");
Last edited by odklizec on Fri May 17, 2013 8:23 am, edited 1 time in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Need a snippet to create user name randomaly
odklizec wrote:Hi,
Try this...Code: Select all
string DateStr = DateTime.Now.ToString("yyyyMMddHHmmss");
Thanks for your reply
As I'm green to ranorex and for C# or VB.... Where I put this snippet?
Thanks
Re: Need a snippet to create user name randomaly
Don't worry, I'm a C# noob as well As to where to place this code, it depends where and how you want to use it? You should place it somewhere before the code where you want to use the date string.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration