Test Iterations and Variables

Ranorex Studio, Spy, Recorder, and Driver.
AccidentReport
Posts: 78
Joined: Tue Dec 04, 2012 2:30 pm

Test Iterations and Variables

Post by AccidentReport » Wed Dec 11, 2013 10:53 am

I may be having a bit of a struggle here with something obvious but I need some help.

I have a test setup to test a login to an application. Hard coded it works correctly for one user, howevere I want to tset multiple users. The test that logs in is part way through. Is it possible to use the data source to interate the whole test and not just the bit part way that uses the variable?

Swisside
Posts: 92
Joined: Thu Oct 10, 2013 10:40 am

Re: Test Iterations and Variables

Post by Swisside » Wed Dec 11, 2013 12:57 pm

Hello

What do you mean by "the test is in part ways" ? Many test cases ?


It's hard to figure out your problem without additional details :D


Swiss'
A simple thank you always does wonders !

AccidentReport
Posts: 78
Joined: Tue Dec 04, 2012 2:30 pm

Re: Test Iterations and Variables

Post by AccidentReport » Thu Dec 12, 2013 9:28 am

Yeah I was a bit rushed yesterday when posting due to a meeting. A bit of clarification needed...

Testcase1
>>> Testcase_Open
>>>>>> Module_Start_App
>>>>>> Module_Navigate_To_Login
>>> Testcase_Login
>>>>>> Module_Enter_Credentials
>>>>>> Module_Press_Login
>>> Testcase_Do_Things
>>>>>> Module_Blah_Blah
>>> Testcase_Logout
>>>>>> Module_Press_Logout
>>>>>> Module_Confirm_Logout
>>> Testcase_Close
>>>>>> Module_Close_App

This is a basic version of my test. So it opens the app, navigates to the login page, logs in, does some stuff, logs out, and then closes the app. The thing is that the system has 3 basic types of user: customer user, customer admin and Super User. I've created a data source table with the 3 different user details in and can link it up to the "Module_Enter_Credentials" but it then tries to loop around that testcase until it's done all three. This is not what I want. I basically want it to run the whole of Testcase1 with the first row of user details, then iterate around and do the whole testcase again with the next, and so on.

How do I achieve this?

Swisside
Posts: 92
Joined: Thu Oct 10, 2013 10:40 am

Re: Test Iterations and Variables

Post by Swisside » Thu Dec 12, 2013 11:06 am

Hello

As you said, as soon as you bind a module variable to a data column it's going to iterate for each line.

My first idea would be to use only one Testcase like below and use folders or group modules to regroup the modules if needed.

Testcase1
>>>>>> Module_Start_App
>>>>>> Module_Navigate_To_Login
>>>>>> Module_Enter_Credentials
>>>>>> Module_Press_Login
>>>>>> Module_Blah_Blah
>>>>>> Module_Press_Logout
>>>>>> Module_Confirm_Logout
>>>>>> Module_Close_App

It seems that you don't need that many TestCases in the example you provided. However if you do need them let me know I'll try to find another way.
A simple thank you always does wonders !

AccidentReport
Posts: 78
Joined: Tue Dec 04, 2012 2:30 pm

Re: Test Iterations and Variables

Post by AccidentReport » Thu Dec 12, 2013 2:58 pm

It was an overly simplified example of the test structure. I do have tests within tests to achieve certain tasks.

Best I can come up with at present is an extra module in the top level test case which gets the values and assigns them to variables that the test further down can access and read from. Just wondered if there was a better way of doing it?

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

Re: Test Iterations and Variables

Post by krstcs » Thu Dec 12, 2013 3:17 pm

Actually, if you put the data source on "Testcase1" and do not put a data source on the sub-cases, it will work the way Swisside is suggesting, as well, without changing your structure.

Data connectors are seen by, and available to, all children of the test case you put them on. They cascade down, so-to-speak.

I routinely structure my test cases the way you have due to the complexity of my data sets and the need to loop through certain areas multiple times (like adding items to a shopping cart for each customer, for example).
Shortcuts usually aren't...

AccidentReport
Posts: 78
Joined: Tue Dec 04, 2012 2:30 pm

Re: Test Iterations and Variables

Post by AccidentReport » Thu Dec 12, 2013 3:49 pm

krstcs wrote:Actually, if you put the data source on "Testcase1" and do not put a data source on the sub-cases, it will work the way Swisside is suggesting, as well, without changing your structure.
That's exactly what I wanted to do. I must have been asleep or something. Thanks a lot. My test now runs exaclty as I would want it to!