I have built a usercode library and I inherit the module class so that users can add a usercode line to the recordings and select the function they want from the drop-down.
e.g. the Generic code library is declared
Public Class GenericUserCode
#Region "Global Functions"
Public Sub CreateEntry( EntryName as String)
...
End Sub
#End Region
The Usercode module (manually edited) is
Public Partial Class CreateStartingPosition
Inherits GenericUserCode
...
End Class
I would like the bit which is underlined to be added whenever a new recording module (rxrec) is added.
Is this possible? I cannot find it in the Options\templates . I use VB.NET (as you can see from the syntax).
Thanks,
OrbisTest
Can I change the code template for usercode module
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Can I change the code template for usercode module
Hello,
It is possible to create a template for a User Code module that inherits a custom base class.
You would need to adjust the template that is stored in the following location:
Currently, it's not possible to use a custom base class for a Recording module to use its methods.
I have forwarded your feature request to our development team.
Regards,
Markus (T)
It is possible to create a template for a User Code module that inherits a custom base class.
You would need to adjust the template that is stored in the following location:
Code: Select all
C:\Program Files (x86)\Ranorex 4.0\RanorexStudio\AddIns\AddIns\Misc\RxSharpdevelop\Templates\Files\VBNet\UserCodeModule.xft
I have forwarded your feature request to our development team.
Regards,
Markus (T)
Re: Can I change the code template for usercode module
it could be heplfull for me
i try to customize the file but i get the error below
apparently i've put my own code in a wrong place in the file
where must we put the custom code ?
Thank you to give us precision about that tip
i try to customize the file but i get the error below
apparently i've put my own code in a wrong place in the file
where must we put the custom code ?
Thank you to give us precision about that tip
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Can I change the code template for usercode module
Hello,
We don't recommend to change the template for a User Code module.
According to your error message, it seems that you try to use an invalid character in your custom template file at line 42 position 8.
What you want to do in your template?
Regards,
Markus (T)
We don't recommend to change the template for a User Code module.
According to your error message, it seems that you try to use an invalid character in your custom template file at line 42 position 8.
What you want to do in your template?
Regards,
Markus (T)
Re: Can I change the code template for usercode module
Hi Markus,
I want to add a few user code functions that i use for each module.
Each time i create a module, i have to add those functions.
To go faster, i've added this functions in tools/option/coding/code templates.
Have them in the template could be the best. I just want to know where can i put my few routine functions in the template.
Thanks
I want to add a few user code functions that i use for each module.
Each time i create a module, i have to add those functions.
To go faster, i've added this functions in tools/option/coding/code templates.
Have them in the template could be the best. I just want to know where can i put my few routine functions in the template.
Thanks
Re: Can I change the code template for usercode module
Jumping in here... Why not create a framework DLL that contains all you reusable methods. The make a reference to that DLL from each of your scripts. This way each test will have access to your methods whenever they need them. Further, if you have to make bug fixes, changes or even add new methods, all you have to do is work in the framework DLL then all your test scripts will automatically get the updated code.
The way you are working right now, yf you keep copying the same code in all your scripts, then need to make a change, you will have to visit each script individually to make that same change.
The way you are working right now, yf you keep copying the same code in all your scripts, then need to make a change, you will have to visit each script individually to make that same change.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Can I change the code template for usercode module
Hi Ciege,
Thank you for your advice. It's a best practice.
I plan to apply it next week.
Otherwise, i don't think that functions added in the DLL will be directly accessible from a user code combobox of a module. I will have to add each needed function in the user code page before call it from a "user code" action of a module. That was my first purpose.
Have a nice weekend
Regards,
Florent
Thank you for your advice. It's a best practice.
I plan to apply it next week.
Otherwise, i don't think that functions added in the DLL will be directly accessible from a user code combobox of a module. I will have to add each needed function in the user code page before call it from a "user code" action of a module. That was my first purpose.
Have a nice weekend
Regards,
Florent
Re: Can I change the code template for usercode module
Please excuse me if I am missing something obvious but I am not a .net programmer.
I have written several re-useable functions (subs) and it seems that putting these into a DLL is s great idea. I know what a DLL is and I can see how to reference it from a project BUT I can't see how to take a .vb and make a DLL from it.
Please be gentle ... It's been a long week.
Thanks
orbistest
I have written several re-useable functions (subs) and it seems that putting these into a DLL is s great idea. I know what a DLL is and I can see how to reference it from a project BUT I can't see how to take a .vb and make a DLL from it.
Please be gentle ... It's been a long week.
Thanks
orbistest
Re: Can I change the code template for usercode module
First, this depends on the IDE you are using (RanorexStudio or Visual Studio)...
Th big picture with Visual Studio you should create a new Class Library solution. Setup your namespace with whichever public classes you want. Your public methods live within the appropriate public classes. These are the methods that will be shared publicly when referencing the DLL...
I would suggest doing a Google search on how to create a DLL in the IDE of your choice or ask one of your developers to help you. It really is quite simple to create one once you've done it...
Here is a quick one I just found in a few seconds of Google searching: http://www.codeproject.com/Tips/319950/ ... ual-studio
Th big picture with Visual Studio you should create a new Class Library solution. Setup your namespace with whichever public classes you want. Your public methods live within the appropriate public classes. These are the methods that will be shared publicly when referencing the DLL...
I would suggest doing a Google search on how to create a DLL in the IDE of your choice or ask one of your developers to help you. It really is quite simple to create one once you've done it...
Here is a quick one I just found in a few seconds of Google searching: http://www.codeproject.com/Tips/319950/ ... ual-studio
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Can I change the code template for usercode module
Let me jump into that discussion
Let me know if that satisfies your needs. IMHO with that functionality, there should not be the need to change the usercode template any more.
Regards,
Alex
Ranorex Team
They will be accessible directly from the recorder UI view if you let the recording inherit from the class holding your utility methods. In other words: Create a utility class in a DLL or somewhere in your project; add a reference to the DLL containing your utility class; then edit the recording usercode file and let the recording inherit from the utility class. Now the utility methods should be visible in the recorder UI, too, if you create a user code action.Florent wrote:Otherwise, i don't think that functions added in the DLL will be directly accessible from a user code combobox of a module. I will have to add each needed function in the user code page before call it from a "user code" action of a module.
Let me know if that satisfies your needs. IMHO with that functionality, there should not be the need to change the usercode template any more.
Regards,
Alex
Ranorex Team
Re: Can I change the code template for usercode module
Hi,
I think this sounds very intresting. Could someone please describe how to create such a DLL project with shared methods in Ranorex Studio? And how to use them from other projects?
Thanks in advance.
I think this sounds very intresting. Could someone please describe how to create such a DLL project with shared methods in Ranorex Studio? And how to use them from other projects?
Thanks in advance.
Re: Can I change the code template for usercode module
As described above, first you need to create the DLL with your shared methods in it... Then, you make a reference to that library from your test(s) and you will have access to the shared methods.Hermch wrote:Hi,
I think this sounds very intresting. Could someone please describe how to create such a DLL project with shared methods in Ranorex Studio? And how to use them from other projects?
Thanks in advance.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Can I change the code template for usercode module
i triedSupport Team wrote: Let me know if that satisfies your needs. IMHO with that functionality, there should not be the need to change the usercode template any more.
it's ok
that is what i was looking for
thanks a lot