Reusable recording

Best practices, code snippets for common functionality, examples, and guidelines.
prasoon.jmit
Posts: 13
Joined: Mon Dec 09, 2019 1:37 pm

Reusable recording

Post by prasoon.jmit » Mon Dec 09, 2019 1:42 pm

Hi,

I have one "Recording"that has "User Code". In "User Code" the method that is present that expect first argument as "Repository Item".
I want to use this "Recording" at multiple places and every time different "Repository Item" will be passed. Please help me how to achieve this.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6163
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Reusable recording

Post by odklizec » Tue Dec 10, 2019 12:12 pm

Hi,

I'm afraid, there is currently no way to pass the repo element as variable. Therefore, the only thing you can do is to create multiple recording modules, where each module uses the same method (using user code collection) and then link different repo item in each recording module. So basically, each module will use the same method with different repo element.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

prasoon.jmit
Posts: 13
Joined: Mon Dec 09, 2019 1:37 pm

Re: Reusable recording

Post by prasoon.jmit » Fri Dec 13, 2019 1:00 pm

Thanks for the reply.

Actually that will create duplicate sort of recordings and code maintainence will be difficult.

Suppose I have 2 nodes of tree in my wpf application. In one case click on node 1 is required while in other cases click on node 2 is required. Can't we achieve that using one recording only?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6163
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Reusable recording

Post by odklizec » Fri Dec 13, 2019 1:08 pm

Hi,

I'm afraid, I don't know what kind of code sample you are looking for? For an example of method, with repo elements as parameters, check these posts:
https://www.ranorex.com/forum/empty-tex ... tml#p52915
https://www.ranorex.com/forum/change-se ... tml#p56855
https://www.ranorex.com/forum/using-ins ... tml#p56677
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

raygoel
Posts: 1
Joined: Tue Sep 15, 2020 3:38 pm

Re: Reusable recording

Post by raygoel » Mon Sep 21, 2020 3:00 pm

I also have this question. From the looks of it, Recording module appears to be a library of recordings that a user is building. I expected to be able to drag and drop these recordings from the module to my test cases.
Is there a way to achieve that? Or do I have to build user code modules to achieve this for my tests.

The scenario is that I have a few test cases (say T1, T2 and T3).
T 2 and T3 include the steps from T1 so I would want to use the recordings I made for T1 in T2 and T3.

Thanks in advance!
Ray