Page 1 of 1

Best way to nest Test Cases for Cross Browser testing?

Posted: Fri Feb 27, 2015 1:30 pm
by Fergal
Ranorex 5.2.2

My cross browser test cases are set up as follows. The top level test case opens the application in the browser. This test case is data driven and the browser is entered as a variable. All subsequent tests are nested under this open browser test case.

The issue with this approach, is that when a Test Configuration, which only includes a small number of test cases, is run, the test run opens the browser again, even when the browser is open and I don't want it to open again.

Is there a better way to nest cross browser test cases?

One approach I have been considering is creating a top level test case, which in itself does nothing. Then nesting all other test cases, including the open browser one, underneath it. Is there anything wrong with that approach?

Thanks!

Re: Best way to nest Test Cases for Cross Browser testing?

Posted: Fri Feb 27, 2015 1:51 pm
by CookieMonster
Hi Fargal,

Put your open browser script into the setup section. You can activate Setup / Teardown, by right click the test suite. Then the script will be executed only once.

Cheers
Dan

Re: Best way to nest Test Cases for Cross Browser testing?

Posted: Fri Feb 27, 2015 2:49 pm
by krstcs
Your test suite should look like this:

Code: Select all

Suite
--TestCase1 -> Browser List
----Open Browser Module
----TestCase2 -> Other data
------Other Modules
----Close Browser Module
Using Setup/Teardown won't help because the Setup/Teardown is still run for each iteration of the test case, or only once for the suite. Setup/Teardown only does one thing: it makes Ranorex execute those modules every time, regardless of errors or other issues.
You can put the Open Browser and Close Browser modules in Setup/Teardown (respectively) if you want, but they still need to be structure the way I did it above.

Re: Best way to nest Test Cases for Cross Browser testing?

Posted: Fri Feb 27, 2015 3:23 pm
by CookieMonster
Hi Krstcs,

I won't unfriendly :oops:, but I'm not completely agree with you or did I understand test case wrong?.
But the setup and tear down will be only called once. Even if you work with iterations.
I made small example, I will attach it to this post.

Regards
Dan

Re: Best way to nest Test Cases for Cross Browser testing?

Posted: Fri Feb 27, 2015 3:58 pm
by krstcs
There are Setup/Teardown sections in EACH Test Case AND in the Suite.

The Suite Setup/Teardown will only be run once.

But the Test Case Setup/Teardown will be run for EVERY iteration.


Fergal needs to open multiple browsers, so he has to do it the way I put in my previous post.

Re: Best way to nest Test Cases for Cross Browser testing?

Posted: Fri Feb 27, 2015 4:11 pm
by CookieMonster
Hi krstcs,

Sorry, but I didn't know at all, that you also can set a setup and tear down section at a test case level.
And I learned something in Ranorex :D

Cheers
Dan

Re: Best way to nest Test Cases for Cross Browser testing?

Posted: Mon Mar 09, 2015 10:51 am
by Fergal
Thanks CookieMonster and krstcs for your helpful replies. I will update my cross browser test suites accordingly and reply back if I have any questions.