Data Binding to Module used more than once

Bug reports.
swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Data Binding to Module used more than once

Post by swmatisa » Tue Oct 04, 2011 12:16 pm

WinXP SP3 (WindowsUpdate done)
Ranorex 3.1.0
*********************************
Hello,

I try to use a CodeModule (for exemple CleanupFolder) twice in the same TestCase. I have 2 global parameters:
1) DriveCDirectoryToCleanup
2) DriveDDirectoryToCleanup

When I bind with global parameters, I can only set once the variable (not one for each instance).

Any idea ?

Thanks for your help
SW

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

Re: Data Binding to Module used more than once

Post by Support Team » Tue Oct 04, 2011 1:29 pm

Hi,

That's because you have one physical UserCode file with just one variable and if you want to set this single variable twice in a Test Case, Ranorex will not know which one should be taken first.
So it is not possible to bind a Module Variable twice in a Test Case.

Regards,
Markus
Ranorex Support Team
.
Image

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: Data Binding to Module used more than once

Post by swmatisa » Tue Oct 04, 2011 3:01 pm

Support Team wrote:That's because you have one physical UserCode file with just one variable and if you want to set this single variable twice in a Test Case, Ranorex will not know which one should be taken first.
So it is not possible to bind a Module Variable twice in a Test Case.
OK, I see, but it is not very good for "software reuse". I need to write the same code "many times".

My workaround are:
  • 1) Create a sub TestCase (Work not if setup or teardown)
    2) Create a user code
Is there a possibility to change a variable content in a recording module?
Thanks for your help
SW

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

Re: Data Binding to Module used more than once

Post by Support Team » Wed Oct 05, 2011 2:42 pm

swmatisa wrote:Is there a possibility to change a variable content in a recording module?
Please give me a few more details about this use case. Our variables are just properties as you know them from C#, so of course it is possible to override this properties during the runtime.

Thanks in advance.

Regards,
Peter
Ranorex Team
.
Image

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: Data Binding to Module used more than once

Post by swmatisa » Wed Oct 05, 2011 3:44 pm

Support Team wrote:Please give me a few more details about this use case. Our variables are just properties as you know them from C#, so of course it is possible to override this properties during the runtime.
Abstract:
I want to set a variable in the "Record Module" (not in UserCode).

I will try to explain as simple as possible:
  • 1) What I want to do
    2) How I implement a workaround
What I want to do:
  • 1) I create a smoke test for a lot of "hardware configuration".
    2) For each "hardware configuration" I need to create "dumps" at different moment of the smoke test.
    3) I create a "Code module" or "UserCode" to create the "dumps". Each dump is stored in an directory (bounded with data) and has a FileName.
The "Test Case" (pseudo code):

Code: Select all

- TestPart1
- Variable FileNameForDump ="Part1"
- Dump()
- TestPart2
- Variable FileNameForDump ="Part2"
- Dump()
...
- TestPartn
- Variable FileNameForDump ="Partn"
- Dump()
Workaround (idea, not fully implemented, but near)
  • 1) I create a small dummy application with just one textbox
    2) I launch this dummy application
    3) In the test case, I set the Textbox text to "Part1"
    4) In the code I get the Textbox text and so I can set the dump FileName.
    5) Dump
    ...
I hope it is clear enough...
SW

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

Re: Data Binding to Module used more than once

Post by Support Team » Fri Oct 07, 2011 11:15 am

Hi,

Thank you for your description.
If you want to set Global Parameter or Variable you can handle this by code. I would suggest you to create a Global Parameter with your name "FileNameForDump". Then before you call your dump method you can set the parameter to another value.
TestSuite.Current.Parameters["YourParamName"] = "yourValue";
I would also suggest you to read following lesson in our user guide
http://www.ranorex.com/support/user-gui ... sting.html

Hopefully I understood you correctly and this is what you need.

Regards,
Peter
Ranorex Team
.
Image

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: Data Binding to Module used more than once

Post by swmatisa » Mon Oct 10, 2011 1:26 pm

Support Team wrote:If you want to set Global Parameter or Variable you can handle this by code. I would suggest you to create a Global Parameter with your name "FileNameForDump". Then before you call your dump method you can set the parameter to another value.
OK, but it must be done by user code. My goal is to prepare a framework of functions and after use only "Recording module". So it will be easier to maintain all tests cases done by the different testers.
Support Team wrote:I would also suggest you to read following lesson in our user guide
http://www.ranorex.com/support/user-gui ... sting.html
Before each question I check fist the documentation :)
swmatisa wrote:I want to set a variable in the "Record Module" (not in UserCode).
I use my workaround but I think I am not alone in my case. It is a wish for version 4 or 5 :D

Another wish is the possibility to print Recorder Module (Ranorex View, not only the code).

Thanks for your help
SW

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

Re: Data Binding to Module used more than once

Post by Support Team » Mon Oct 10, 2011 1:38 pm

Hi,

I will add a feature request for an action called "Set Variable" or "Set Parameter". Then you could change the variable in the action grid and you don't have to use the user code file. Is this okay for you?
But I cannot tell you when this feature will be available.

Regards,
Peter
Ranorex Team
.
Image

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: Data Binding to Module used more than once

Post by swmatisa » Mon Oct 10, 2011 1:42 pm

Support Team wrote:I will add a feature request for an action called "Set Variable" or "Set Parameter". Then you could change the variable in the action grid and you don't have to use the user code file. Is this okay for you?
But I cannot tell you when this feature will be available.
Perfect.

Thanks for your help
SW

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: Data Binding to Module used more than once

Post by swmatisa » Wed Apr 04, 2012 1:55 pm

WinXP SP3 (WindowsUpdate done)
Ranorex 3.2.3
*********************************
Hello,
Support Team wrote:But I cannot tell you when this feature will be available.
Did you have planned this or is it under the stack?

Second question:
Some posts ask for parameter(s) to Usercode (http://www.ranorex.com/forum/is-it-poss ... t2576.html). I understand it is not so easy, but I am really interrested for one parameter (string or Ranorex repository element).

Thanks for your help
SW

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

Re: Data Binding to Module used more than once

Post by Support Team » Wed Apr 04, 2012 4:22 pm

Hi,
swmatisa wrote:Did you have planned this or is it under the stack?
It is not scheduled in the current iteration 3.3. We will have a new feature discussion for 3.4 and then the feature will be discussed if we implement it or we postpone it.
swmatisa wrote:Second question:
Some posts ask for parameter(s) to Usercode (http://www.ranorex.com/forum/is-it-poss ... t2576.html). I understand it is not so easy, but I am really interrested for one parameter (string or Ranorex repository element).
User Code Items with parameters will be available with 3.3 and you can use only string for the arguments.

Regards,
Peter
Ranorex Team
.
Image

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: Data Binding to Module used more than once

Post by swmatisa » Thu Apr 05, 2012 7:07 am

Support Team wrote:User Code Items with parameters will be available with 3.3 and you can use only string for the arguments.
Nice, I look forward this new feature.

With string parameters, I will try do a simple workaround of "Set Variable"

Thanks for your help
SW