UserCodeModule excel variable binding next row

Ranorex Studio, Spy, Recorder, and Driver.
oyvindlu
Posts: 3
Joined: Tue Sep 11, 2012 12:36 pm

UserCodeModule excel variable binding next row

Post by oyvindlu » Wed Sep 26, 2012 2:54 pm

Hi

This is probably/hopefully an easy question to answer. I have added a dummy test with one usercode module. In this usercode module I've added a module variables .

Code: Select all

[TestVariable("17EA3FAD-C320-4A0B-B744-1FC1B54B0DE8")]
public string VarLoanSum
{
	get { return _VarLoanSum; }
	set { _VarLoanSum = value; }
}
Then in databinding I've hooked up an Excel file. I then associate the module variable with the column in the excel doc. This i all ok. But I have two rows in my excel doc, the first row i can get data out by
just accessing the module variable

Code: Select all

var value = VarLoanSum;
But how do i get to the next row and get the next row of data and keep my module variable updated.

Doing something like this comes to mind

Code: Select all

TestCase.Current.DataContext.Next()
but it aint working. This I hoped would take me to the next row. (but the module variable (VarLoanSum) is not updated still has old value). How can i get this working ?

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: UserCodeModule excel variable binding next row

Post by krstcs » Wed Sep 26, 2012 7:52 pm

Each row should be it's own data entity and assigned to an individual iteration of a test case/script, so you should not be getting data from the next row.

Try making more columns and putting the data you need for each test iteration in a single row.

For instance, to test login/logout, you could have this dataset:

Code: Select all

(Col1)     (Col2)
NAME      PASSWORD
user1     user1Password
user2     user2Password
Your testcase would look like:
Test Case 1 - Login (Databind - NAME/PASSWORD)
-----LoginScript.rxrec
-----LogoutScript.rxrec


And the system would run Test Case 1 for each row in the datasheet.

Just remember that each row in your databind is a separate test iteration.
Shortcuts usually aren't...