Page 1 of 1

Importing testcase into different testsuite

Posted: Mon May 26, 2014 9:59 am
by Anette
hey,

this might be a dumb question, but I haven't used this tool for long. :)

I made a testcase, that in one testsuite that I would like to use in a different test suite. Is there a way to import it to a different testsuite?(Preferably so the code behind it is only located one place, and any changes will change the testcase in both suites)

Re: Importing testcase into different testsuite

Posted: Tue May 27, 2014 2:56 pm
by krstcs
Welcome!

It is not a dumb question, however, the answer is complex. :D

Yes, it is possible to copy a test case (or cases) from one test suite to another. It doesn't copy the data connectors, so your bindings will be cleared. It also doesn't keep both updated if you make changes to one or the other. However, the good news is that the modules that actually contain the actions and steps will still be referenced, so they can be changed in one place and it will affect all the places it is used.


A couple of suggestions, if you are new to Ranorex:

First, try to make each recording module as small as possible. If you need to click the OK button, make a module that just clicks that button and call it "Click_OKButton". It will do be easier to understand what the modules do if you do this. The name will tell you, and you will always know that it does that one thing and that one thing only. You can use the module anywhere in the test suite you need to. Plus, the naming convention will make it easy to read the test case and easier for new people to understand the tests. As another example, if you need to enter a username make a module called "Enter_UserName" and do everything needed for entering that text in that field inside that module. The module should also have a variable called "UserName" (matching the module name, so everyone knows what value to pass) that takes the username in a given run. For example, my "Enter_UserName" module looks like:

Mouse -> Click -> UserNameField (the repo object)
Keyboard -> Shortcut -> "Ctrl-A" -> UserNameField
Keyboard -> Shortcut -> "Del" -> UserNameField
Keyboard -> KeySequence -> $UserName (enters the UserName variable - "$" denotes variables)

That's it, no more, no less. The Ctrl-A and Del make sure that I don't get weird artifacts from clicking in the middle of an existing piece of text and then typing. If you NEED to test that, make a separate module for that purpose, but again, make it small. Keeping the modules small and specific also means you can mix-and-match the modules in the order needed in your test cases and there is no need to remake modules for different logic paths. Also, I would suggest that you keep all related tests in the same solution in Ranorex. It will make it easier to reference the modules if they are all in one place.

Second, if you are going to be doing any really heavy-weight testing, you should look into using SQL Server Express for your data source. It is complex to start out with, but it will help you separate your data from your test. And, it is also much more flexible than the built-in simple data connectors, or Excel. If you can't use SQL, then look at Comma Separated Value files. They can be edited by Excel (or any free alternative) and any text editor. XLS/XLSX files can only be edited by Excel or similar spreadsheet software.

Third, look into a Continuous Integration solution like Jenkins (what I use, it is free) or Bamboo. These are extremely useful for managing the test runs and reporting.


Sorry for the wall of text. :D Hopefully this will help you easy into Ranorex a bit.

Re: Importing testcase into different testsuite

Posted: Tue May 27, 2014 2:58 pm
by Support Team
Hi Anette,
Unfortunately it is not possible to link a test case to another test suite in an second project. It is only possible to add existing Recording Modules and Code Modules to another project.
This can be done by performing the following steps:
  • Right Click on your project in the Projects View
  • Select “Add Existing Item”
  • Choose a Recording Module or a Code Module from another Solution.
  • In the following dialog, you can choose how to resolve the missing repository reference
ChooseRepositoryReference.jpg
  • Confirm this dialog with OK
If you want to use your modules on multiple machines I would recommend to use a Source Control System.
Please have a look at this link, for more information about Source Control.

Regards,
Markus(S)

Re: Importing testcase into different testsuite

Posted: Wed Jun 25, 2014 7:00 am
by Anette
Thanks for the answers and suggestions, and sorry for the late reply.
I got taken of Ranorex for a while cause we were swamped with other things. :)
I already have divided the different testcases into modules, but I think I can probably do that even more, to reuse as much as possible.
I will look into adding the recording modules instead, and just have to remember to make changes in both projects. :)