Iteration value

Ask general questions here.
skhanpara
Posts: 101
Joined: Wed Apr 23, 2014 3:55 pm

Iteration value

Post by skhanpara » Thu Jun 12, 2014 3:53 pm

Hi

I was able to create a file which can transfer data to excel file.

I want to create a new excel file for each iteration

Is there any code that can get me current iteration value?

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Iteration value

Post by Support Team » Fri Jun 13, 2014 9:16 am

Hello skhanpara,

You could specify a local variable in your recording module(UserCode.cs), update the value of the variable in each iteration of your data-driven test.
public partial class Recording1
    {

        private int i =1;

       
        private void Init()
        {
            // Your recording specific initialization code goes here.
        }

        public void iteration()
        {
                Report.Info("i: " + i);
                i++;
        }
Another possibility to retrieve the current iteration number is via the internal property "CurrentTestIterationActivity.Index":
int index = Ranorex.Core.Reporting.TestReport.CurrentTestIterationActivity.Index;
Please note that this is internal API, we do not recommend to use it and preserve the right to change internal methods and properties at any time.

Regards,
Robert

skhanpara
Posts: 101
Joined: Wed Apr 23, 2014 3:55 pm

Re: Iteration value

Post by skhanpara » Fri Jun 13, 2014 3:25 pm

Thanks

I am calling the variable from the corresponding file but it return back the default value instead of excel data.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Iteration value

Post by Support Team » Tue Jun 17, 2014 9:23 am

Hello skhanpara,

I’m afraid that I do not fully understand to which variable you are referring to. May I ask you to rephrase your issue?

Regards,
Robert

skhanpara
Posts: 101
Joined: Wed Apr 23, 2014 3:55 pm

Re: Iteration value

Post by skhanpara » Tue Jun 17, 2014 7:22 pm

i got the solution

thanks for your reply