Using output variables from other testcases

Ranorex Spy, Recorder, and Studio.
monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Using output variables from other testcases

Post by monkey2012 » Tue Dec 11, 2012 9:28 pm

Hi Support Team,

How do I use the outputs from different test cases as inputs for another test case?
Example:

Recording1.rxrec
Recording1.UserCode.cs
private void Init()
{
// Your recording specific initialization code goes here.
out1 = CreateObject(s1,s2);
}
public string CreateObject(string s1, string s2)
{
...........
return out1;
}

Recording2.rxrec
Recording2.UserCode.cs
public void CombineObjects(string in1, string in2)
{
......
}

TestProject2 - Test Suite
TestCase_1
Recording1
TestCase_2
Recording1
TestCase_3
Recording2

How can I do data binding so that:
in1 in TestCase_3 (Recording2) uses the output "out1" from TestCase_1(Recording1)
in2 in TestCase_3 (Recording2) uses the output "out1" from TestCase_2(Recording1)

Thanks

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Using output variables from other testcases

Post by Support Team » Wed Dec 12, 2012 10:39 am

Hi,

Just create a new global or test case parameter and bind the variables from the different recordings to the parameter.
This will allow you to set the variables from the other modules which are linked via the parameters automatically.
This is also described in the following section of our UserGuide: Ranorex Test Suite, search for "parameters".

Regards,
Markus
.
Image

monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Re: Using output variables from other testcases

Post by monkey2012 » Wed Dec 12, 2012 2:55 pm

It only shows you how to bind the variables from different modules within the same test case, not as my situation.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Using output variables from other testcases

Post by Support Team » Wed Dec 12, 2012 3:42 pm

Hi,

If I got you correctly it should run as I described.
I also attached a sample solution where you can see how you can pass variables to recording of other test cases.

I hope this will help you solve the issue!

Regards,
Markus
Attachments
SampleSolution1.zip
(297.17 KiB) Downloaded 232 times
.
Image

monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Re: Using output variables from other testcases

Post by monkey2012 » Wed Dec 12, 2012 4:19 pm

I don't think it is the same as my case.

TestProject2 - Test Suite
--> TestCase_1
--------> Recording1
--> TestCase_2
--------> Recording1
--> TestCase_3
--------> Recording2

Please see the attached solution
Attachments
TestProject2.zip
(14.4 KiB) Downloaded 237 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Using output variables from other testcases

Post by Support Team » Thu Dec 13, 2012 1:57 pm

Hi,

Thanks for the solution!
I changed your project a bit and now it works as you expected.
You have to bind the output variables of Recording1 to global parameters (one for each output variable) and the input variables of Recording2 to the same parameters.
For more details please take a look at the attached solution.

Regards,
Markus
Attachments
TestProject2.zip
(15.76 KiB) Downloaded 205 times
.
Image

monkey2012
Posts: 77
Joined: Wed Sep 26, 2012 8:15 pm

Re: Using output variables from other testcases

Post by monkey2012 » Mon Dec 17, 2012 6:46 pm

Thanks.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Using output variables from other testcases

Post by Support Team » Tue Dec 18, 2012 11:31 am

I am glad I was able to help :)!

Regards,
Markus
.
Image