Running specific Testcase from command line ignores Startup

Ask general questions here.
IanKnight
Posts: 33
Joined: Thu Feb 21, 2013 12:52 pm

Running specific Testcase from command line ignores Startup

Post by IanKnight » Thu May 28, 2015 2:05 pm

Hi,

I am looking at running a test case from the command line, however when I do this the Setup region from the Test suite is not executed.

The test suite setup region performs the login so if I run the test case individually the login is not performed.

Is there a switch / parameter I can use to make sure the test suite setup is run before the specific test case is executed ?

Thanks

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

Re: Running specific Testcase from command line ignores Startup

Post by odklizec » Thu May 28, 2015 2:24 pm

Hi,

I don't think there is a switch or parameter to do what you want (calling specific Test Case but using TestSuite Setup/TearDown). However, there is a very simple solution of your problem using Run Configurations...
http://www.ranorex.com/support/user-gui ... html#c3019

Simply, create a configuration (or multiple configurations) holding only the necessary TestCases you want to run. Then instead of starting the test by calling a particular Test Case, run whole solution with parameter /rc:configuration_name
This assures the TestSuite setup/teardown is used along with selected TestCases.
Hope this helps?
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

IanKnight
Posts: 33
Joined: Thu Feb 21, 2013 12:52 pm

Re: Running specific Testcase from command line ignores Startup

Post by IanKnight » Thu May 28, 2015 2:49 pm

Thanks for the reply, I'll look into that, but it doesn't really give the flexibility I need to just select any test case as required.

I'd have to create a configuration for every possible combination I need which could be considerable.

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

Re: Running specific Testcase from command line ignores Startup

Post by odklizec » Thu May 28, 2015 3:20 pm

I understand. However, I still think the "Run Configurations" is the best option.

If you still prefer to call individual TestCases and use the steps from test suite setup/teardown section, then I'm afraid, you will have to adapt your test cases and add required (global) steps to each test case setup/teardown.

What you trying to achieve is in my opinion against the philosophy of Test Suite usage. You can't just use the individual Test Case and still access the Test Suite setup/teardown? It's like if you would call a TestCase2 nested in TestCase1 and yet expect that TestCase1 setup/teardown is still executed? ;) It's exactly the same with Test Suite setup/teardown sections.
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

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Running specific Testcase from command line ignores Startup

Post by krstcs » Thu May 28, 2015 3:34 pm

I would suggest that if you don't want to use the configuration system that Ranorex already has, you may want to copy the login modules into each test case that needs it.

However, I would highly recommend using the configuration settings because it really won't be any more work in the long-run. Once you get it setup, all you need to do is maintain it (add, delete, edit configs).

Remember, even though something is more work now, it will probably save you work in the long-run.


Having said that, I will tell you that I don't use run configurations either. My tests are completely data driven. I actually modify which test cases are run by directly manipulating my SQL data connector query strings on the fly. This means that my tests basically have every test case set as active, but the data determines which cases get run. Remember that test cases are basically just big for..each loops. For each ROW in DATASET, do the following... This means that at runtime if the query doesn't return any rows, the test case will not be run. Unfortunately this takes a lot of up-front work and a good understanding of datasets and databases.
Shortcuts usually aren't...

IanKnight
Posts: 33
Joined: Thu Feb 21, 2013 12:52 pm

Re: Running specific Testcase from command line ignores Startup

Post by IanKnight » Thu May 28, 2015 4:07 pm

Thanks again for the replies and I can see the merits of the approaches, although I really don't want to get as complex as using SQL driven setups.

So quick question about configurations, If I set up my configurations so there is one configuration per test case, do I need to compile every configuration separately or will one build of the test suite build all configurations at the same time ?

What I don't want to do is set up 30 configurations and have to build them 30 times when I want to update the test suite.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Running specific Testcase from command line ignores Startup

Post by krstcs » Thu May 28, 2015 4:28 pm

One compile.

Ranorex builds the whole project into one EXE that contains all of the modules and such. The configuration is stored separately in the rxtst file (an xml file that tells the EXE what to do). In fact, you can change the configurations on the test system without recompiling, if you use the Ranorex Test Suite Runner tool.

FYI: Ranorex Studio recompiles anytime you hit the run button, whether there's been a change or not. Now, MSBuild may not actually BUILD a new exe/dll if it doesn't need to, but Ranorex will run MSBuild everytime you run something.


Edit to add: The rxtst file is the SUITE, and it is copied to the build output directory (\bin\debug or \bin\release, depending on what build config you have selected). The rxtst file should not be moved to a different directory than your exe.
Shortcuts usually aren't...

IanKnight
Posts: 33
Joined: Thu Feb 21, 2013 12:52 pm

Re: Running specific Testcase from command line ignores Startup

Post by IanKnight » Fri May 29, 2015 2:19 pm

Thanks again for the responses.

I have tested it using configurations, and it does work quite well with what I am planning to do, it will take a little while to create all the configurations required, but it will be worth it in the end.

I just have to remember to build with the full test suite selected, as if I build when one of the smaller run configurations is selected that configuration is run as the test suite.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Running specific Testcase from command line ignores Startup

Post by krstcs » Fri May 29, 2015 3:04 pm

Yeah, the run that is set when you compile is the DEFAULT if you don't pass in the run config as a command-line parameter.

I would recommend looking into a continuous integration solution like Jenkins as well. It will allow you to setup jobs to run each of the configurations. This will make it a lot easier on you to know what is running where and whether it passes or not. Again, there is some up-front work, but it is well worth it in the end.
Shortcuts usually aren't...