Hi,
I would like to perform a setup/teardown in a test case where the setup runs at the beginning, a number of the same test cases are run and then the teardown is run at the end. This works when the setup/teardown is at the test suite level, but it doesn't work correctly at the test case level. Why even provide the option of setup/teardown at the test case level if it repeats itself at each iteration of the test case anyway? Hopefully someone understands what I am getting at. Otherwise I can explain in further detail.
Setup/Teardown per test case
Re: Setup/Teardown per test case
What does your current test suite structure look like? Have you tried using smart folders within your test case(s)? It sounds like you are using either data binding or the iteration counter on your test case. Perhaps making a smart folder within the test case container and then applying the data binding / iteration counter to the smart folder could work for you. Perhaps something like this:
[TestCase]
--[Setup]
----[Smart Folder] *contains data binding / iteration counter
------[test modules] (these modules would be iterated over)
--[Teardown]
If this is not quite what you are looking for, it would be helpful if you are able to provide a screenshot of your test suite or at least an example.
[TestCase]
--[Setup]
----[Smart Folder] *contains data binding / iteration counter
------[test modules] (these modules would be iterated over)
--[Teardown]
If this is not quite what you are looking for, it would be helpful if you are able to provide a screenshot of your test suite or at least an example.
-
- Posts: 42
- Joined: Tue Dec 20, 2016 10:16 pm
Re: Setup/Teardown per test case
I could use smart folders, but I would rather not as it is less organized from my perspective. I want something like this:
Test Suite
Test Suite Setup
- Testcase1
- Setup
- test case modules test case 1 (multiple iterations)
- Testcase2
- Setup
- Test case modules test case 2 (multiple iterations)
What is the purpose of the setup if it runs every time during a test case? Why not just make it a test case module? I want the setup to run once and then run through the test case modules multiple times in a test case.
Test Suite
Test Suite Setup
- Testcase1
- Setup
- test case modules test case 1 (multiple iterations)
- Testcase2
- Setup
- Test case modules test case 2 (multiple iterations)
What is the purpose of the setup if it runs every time during a test case? Why not just make it a test case module? I want the setup to run once and then run through the test case modules multiple times in a test case.
Re: Setup/Teardown per test case
Hi,
In my opinion, the Setup/Teardown implementation, as it is now, is perfectly logical. But of course, it may not suit everybody
The thing is, that both Setup and Teardown are a part of iteration! In other words, the iteration starts once the test reaches the test case/smart folder, containing a data connector. Once the test enters the test case/smart folder, it goes into iteration 1 and so its setup/teardown section. Vega provided you with a perfectly working solution of the problem and it's exactly what I would do in case like yours. This is exactly what smart folders are for
If you don't like the current implementation of Setup/Teardown, you can always suggest a change via Ranorex User Voice platform, available here:
https://uservoice.ranorex.com/forums/15 ... ve-ranorex
In my opinion, the Setup/Teardown implementation, as it is now, is perfectly logical. But of course, it may not suit everybody
![Wink ;)](./images/smilies/icon_wink.gif)
![Wink ;)](./images/smilies/icon_wink.gif)
https://uservoice.ranorex.com/forums/15 ... ve-ranorex
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
-
- Posts: 42
- Joined: Tue Dec 20, 2016 10:16 pm
Re: Setup/Teardown per test case
I get your point. Thanks for the assistance.
Re: Setup/Teardown per test case
Hi, I will borrow this topic if I may ![Smile :)](./images/smilies/icon_smile.gif)
In my cas (picture) why teardown section is only triggered once - for the first test case. Why it doesn't trigger at the end of any of 4 test cases? Am I missing something?
Thanks
![Smile :)](./images/smilies/icon_smile.gif)
In my cas (picture) why teardown section is only triggered once - for the first test case. Why it doesn't trigger at the end of any of 4 test cases? Am I missing something?
Thanks
You do not have the required permissions to view the files attached to this post.
Re: Setup/Teardown per test case
Hi,
The Teardown section from your screenshot is at TestSuite level, which means it will be performed after all test cases are finished!
If you want a Teardown section to be performed at the end of each test, you must add Teardown section to each test case. Just right click the TestCase and from the context menu select "Add Teardown".
The Teardown section from your screenshot is at TestSuite level, which means it will be performed after all test cases are finished!
If you want a Teardown section to be performed at the end of each test, you must add Teardown section to each test case. Just right click the TestCase and from the context menu select "Add Teardown".
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Setup/Teardown per test case
hi
That was my previous solution, but i wanted to have this teardown section at one place.So now, If i run only the first test case it looks like the teardown is triggered since the browser gets closed at the end of test. So I assume that would be the case for the rest test cases too...
It looks like I was wrong.
I was thinking how to do it, without copying the teardown section for each test case and bind parameters and variables and so on..
![Smile :)](./images/smilies/icon_smile.gif)
That was my previous solution, but i wanted to have this teardown section at one place.So now, If i run only the first test case it looks like the teardown is triggered since the browser gets closed at the end of test. So I assume that would be the case for the rest test cases too...
It looks like I was wrong.
![Smile :)](./images/smilies/icon_smile.gif)
Re: Setup/Teardown per test case
How exactly do you run your tests? The Test Suite Teardown should run always if the Test Suite is finished. Of course, if you, for example, run only a selected test case (via command line) and not the whole test suite, the Test Suite Teardown is not triggered
The solution is to use Run Configurations, where you can define which test cases should be included and then start the whole test suite with particular run configuration (instead of calling specific test case).
![Wink ;)](./images/smilies/icon_wink.gif)
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
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
Re: Setup/Teardown per test case
Yes, maybe i will include run configuration again. I mean, so far i was using run configurations. But the test scenario became complex, so i open up a separate test suite, whereas I compose this complex test scenarion within test case.
I had an idea, to compose a test scenario in test case, so I would run it and it would represent the whole scenarion. Then I noticed that teardown region is always the same, so I was trying to avoid it
Maybe the simpliest way is to use run configurations again.![Smile :)](./images/smilies/icon_smile.gif)
I had an idea, to compose a test scenario in test case, so I would run it and it would represent the whole scenarion. Then I noticed that teardown region is always the same, so I was trying to avoid it
![Smile :)](./images/smilies/icon_smile.gif)
Maybe the simpliest way is to use run configurations again.
![Smile :)](./images/smilies/icon_smile.gif)
Re: Setup/Teardown per test case
Odklizec, one more question If I may? Is there a way to use a validation like IF-ELSE option? Many times I am using validation to check wheter some item is present or not. Usually i do this no the start, but I don't have any options like IF-THEN to continue or to skip some test case if validation failed.
Thanks
Thanks
Re: Setup/Teardown per test case
I have one more question, regarding my situation.
If I run my testcase through commandline, sending of email doesn't get triggered and i can't figure it out why. If I ran the test through ranorex, everything is fine.
For the main testsuite, works within command line. But for newly added testsuite, it doesn't...
Example:
If I run my testcase through commandline, sending of email doesn't get triggered and i can't figure it out why. If I ran the test through ranorex, everything is fine.
For the main testsuite, works within command line. But for newly added testsuite, it doesn't...
Example:
You do not have the required permissions to view the files attached to this post.
Re: Setup/Teardown per test case
Solution is to set a run configuration with the same steps, then teardown si triggered.
-
- Certified Professional
- Posts: 455
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Setup/Teardown per test case
A convenient way to achieve this could be by using error behavior. For example, you could have a few TCs in a smart folder, and set the error behavior of the TC to continue with parent.
Example:
Smart Folder 1
- TC1
- TC2
- TC3
Smart Folder 2
- TC4
If the error behavior of TC1 is set to Continue with Parent, then if TC1 fails, TC2 and TC3 will NOT be run.
More on Error Behavior in the Configure Error Behavior section here.