Best way to nest Test Cases for Cross Browser testing?

Ask general questions here.
Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Best way to nest Test Cases for Cross Browser testing?

Post by Fergal » Fri Feb 27, 2015 1:30 pm

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!

CookieMonster
Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

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

Post by CookieMonster » Fri Feb 27, 2015 1:51 pm

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

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

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

Post by krstcs » Fri Feb 27, 2015 2:49 pm

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.
Shortcuts usually aren't...

CookieMonster
Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

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

Post by CookieMonster » Fri Feb 27, 2015 3:23 pm

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
You do not have the required permissions to view the files attached to this post.

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

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

Post by krstcs » Fri Feb 27, 2015 3:58 pm

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.
Shortcuts usually aren't...

CookieMonster
Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

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

Post by CookieMonster » Fri Feb 27, 2015 4:11 pm

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

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

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

Post by Fergal » Mon Mar 09, 2015 10:51 am

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.