How to execute one test case from another

Best practices, code snippets for common functionality, examples, and guidelines.
ninaddande
Posts: 15
Joined: Mon Apr 25, 2016 7:54 pm

How to execute one test case from another

Post by ninaddande » Mon Apr 25, 2016 8:02 pm

Hi Folks,

I have a question on internal calling of test case from the code of another test case. Actually my scenario is, I have one test case of 10 steps and second test case of 12 steps which has first 10 steps as the first test case.

So I want to find out an option if we can execute first test case from second one and continue with remaining 2 steps of second test. And in this way both the test should come in report with only one execution cycle when we execute the test suite.

Is it possible?

Kindly guide me for this.

Regards,
ND

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

Re: How to execute one test case from another

Post by odklizec » Tue Apr 26, 2016 8:03 am

Hi,

I believe there is no option (definitely not official) to start a test case from code. In fact, I think such approach would cause a lot of mess in test project workflow and I would strongly advise not to use such way, even if exists ;)

I think the best approach to solve your problem is to use run configurations. basically, you can have two separate Test Cases and with Run Configuration you can define which Test Cases should be run. Here is an example how to use Run Configurations to solve your problem...
RunConfigExample.png
RunConfigExample.png (37.85 KiB) Viewed 1458 times
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

ninaddande
Posts: 15
Joined: Mon Apr 25, 2016 7:54 pm

Re: How to execute one test case from another

Post by ninaddande » Tue Apr 26, 2016 5:42 pm

Hi odklizek,

Thanks for your response. Actuall this approach will not suffice as I have test suite with multiple test case which we have to execute weekly so I can not create different runs as such and in any way if I understand this then it will execute both the test cases in one run separately. However I was trying to find the solution which will have single run for both combined (i.e one execution for both) but it should produce report for 2 separate test cases.

Is there any other possibility to do so in other than code.

Regards,
ND

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

Re: How to execute one test case from another

Post by krstcs » Tue Apr 26, 2016 7:49 pm

There is one report for each test suite, unless you used code, which I don't recommend.

My suggestion would be to use the method that Pavel suggested, but create a batch file to run both, one after the other.

Don't over-think it. When people get in trouble with Ranorex it is usually because they tried to force it into doing things a different way than it is designed, but if you change your mentality a bit and rethink how you are approaching the actual test problem, you can do what you really need to do without to much effort. Remember, this isn't a manual test, so don't try to make it work just like manual testing. :D

Hope that helps...
Shortcuts usually aren't...

ninaddande
Posts: 15
Joined: Mon Apr 25, 2016 7:54 pm

Re: How to execute one test case from another

Post by ninaddande » Tue Apr 26, 2016 11:03 pm

Thanks, I will try with this approach if I can manage.

User avatar
Mudhenn
Posts: 20
Joined: Fri Apr 22, 2016 12:28 pm
Location: Vienna, Austria

Re: How to execute one test case from another

Post by Mudhenn » Mon May 02, 2016 10:36 am

Hello

Not sure if I understand your problem right, but maybe there is something in this for you: I work actually on a automated test in which I want to select different recordings for each test-cylce. I am working on an form with different sub-forms and in the test scenarois the "user" should use different parts in every cycle.

So I have an excel-sheet with the different combinations to select (just true or false) and one "recording" for every part of that form.On the beginning of each cycle the code checks or unchecks the recordings which should be executed.

If that corresponds with your problem let me know, I can post you the code to do this.

best regards,
Frank