Tool to print different name at each time we play back.

Class library usage, coding and language questions.
QAtesting
Posts: 10
Joined: Thu Jan 10, 2013 12:12 pm

Tool to print different name at each time we play back.

Post by QAtesting » Tue Feb 26, 2013 10:04 am

Hey,

What code should go in to make Ranorex so that, it can print different name/name+number during the script play back.

Here's what i'm trying to do.

We are trying to run the script, where different names has to be inserted on each play back ( as our application does not support duplication of names) which we are unable to crack it with tool.

So to over come the above problem what steps should we follow.

Example:

If the 1st play back enters the names like C1, E1,T1..N1. In the next play back we want the tool to print C2,E2,T2...N2 so.. on ..

QAtesting
Posts: 10
Joined: Thu Jan 10, 2013 12:12 pm

Re: Tool to print different name at each time we play back.

Post by QAtesting » Tue Feb 26, 2013 11:07 am

In addition we changed the names to variables and specified with default value.
But we would like to add some different numbers kind of thing at the end of the names before printing, while the script is played back.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Tool to print different name at each time we play back.

Post by Ciege » Tue Feb 26, 2013 3:53 pm

You could try this...

At the beginning of your code, create a variable that holds the current date/time stamp.
Append that variable to C, E, T, N...
That way, each time you run the code there will be a unique and different name each time...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

QAtesting
Posts: 10
Joined: Thu Jan 10, 2013 12:12 pm

Re: Tool to print different name at each time we play back.

Post by QAtesting » Fri Mar 01, 2013 2:06 pm

Hi,

So can you just give some idea so that i can implement it. As im not soo familiar with these coding stuff.. :D

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Tool to print different name at each time we play back.

Post by Ciege » Fri Mar 01, 2013 4:29 pm

Just a quick example. You'll have to work out the details of the loop...

Code: Select all

//Start your iteration loop here. 1 - N

// Get the current time & date stamp  
strYear = System.DateTime.Now.Year.ToString();
strMonth = System.DateTime.Now.ToString("MM");
strDay = System.DateTime.Now.ToString("dd");
strHour = System.DateTime.Now.ToString("hh");
strMinute = System.DateTime.Now.ToString("mm");
strSecond = System.DateTime.Now.ToString("ss");
strDateTimeStamp = strYear + "_" + strMonth + "_" + strDay + "___" + strHour + "_" + strMinute + "_" + strSecond;

//Append the tine & date stamp to your variable names
strC = "C"+ strDateTimeStamp;
strE = "E"+ strDateTimeStamp;
strT = "T"+ strDateTimeStamp;
strN = "N"+ strDateTimeStamp;

//Do you tests with the first iteration
//Loop back to the top for the next iteration

If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...