TestSuite Setup & Teardown not executed from command prompt

Best practices, code snippets for common functionality, examples, and guidelines.
nikhil
Posts: 3
Joined: Fri Jan 06, 2017 4:19 pm

TestSuite Setup & Teardown not executed from command prompt

Post by nikhil » Fri Feb 10, 2017 10:00 am

Hi,
I have a Setup and Teardown at the Test Suite level.
When I execute a test case using command prompt, it was observed that the test suite Setup and Teardown were not executed. Is there a way to do the same using command prompt?
The command I've used is like this:
TestSuite.exe / tc:TestCaseName

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

Re: TestSuite Setup & Teardown not executed from command prompt

Post by odklizec » Fri Feb 10, 2017 2:26 pm

Hi,

I believe this is an expected behavior? If you specify a TC to be run from the command line, then the Test Suite setup/teardown sections are logically not run, because only selected TC is started? ;)

To overcome this problem, it's better to use Run Configuration, in which you can define one or multiple TCs, which should be started within the Test Suite.

Read more about Run Configurations here:
http://www.ranorex.com/support/user-gui ... html#c3019
Then use /rc:RunConfigName command line parameter, to start the test suite with selected Run Configuration. 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

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

Re: TestSuite Setup & Teardown not executed from command prompt

Post by krstcs » Fri Feb 10, 2017 2:52 pm

Yeah, that is as designed. The SUITE-level Setup and Teardown sections only run if the whole suite is run.

If you want those modules run when running just a test case you must move the modules to the test case setup/teardown sections, or use run configurations as Pavel suggested. Run configs are probably the better way to go, and while they do require some setup, it is probably better than having to manage copies of the setup/teardown in each test case.
Shortcuts usually aren't...

nikhil
Posts: 3
Joined: Fri Jan 06, 2017 4:19 pm

Re: TestSuite Setup & Teardown not executed from command prompt

Post by nikhil » Fri Feb 10, 2017 3:07 pm

Hello,
Unfortunately, the rc option is not a feasible one for me. :(

There must also be an option which will enable a user to run a test case along with the suite level setups and teardowns. It would be highly beneficial to have such a feature if there already isn't one.

I've also discovered another thread where the same issue was raised.


Is there a way to raise such a request or make a suggestion to Ranorex?

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

Re: TestSuite Setup & Teardown not executed from command prompt

Post by krstcs » Fri Feb 10, 2017 3:08 pm

Last edited by krstcs on Fri Feb 10, 2017 3:09 pm, edited 1 time in total.
Shortcuts usually aren't...

nikhil
Posts: 3
Joined: Fri Jan 06, 2017 4:19 pm

Re: TestSuite Setup & Teardown not executed from command prompt

Post by nikhil » Fri Feb 10, 2017 3:08 pm

krstcs wrote:uservoice.ranorex.com
Thank you :D

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

Re: TestSuite Setup & Teardown not executed from command prompt

Post by krstcs » Fri Feb 10, 2017 3:09 pm

You're welcome! I updated it with the full url for easier usage.
Shortcuts usually aren't...