Ask general questions here.
-
stapes
- Posts: 206
- Joined: Wed Sep 16, 2015 10:55 am
Post
by stapes » Mon May 16, 2016 2:47 pm
Is there a way I can make a bit of code that will be run at the start of every test case?
I am interested in seeing the Report Level & Error Behaviour of each Test Case.
i.e.
Code: Select all
var ts=TestSuite.Current;
var tc1=(TestCase) TestCase.Current ;
Report .Info ("Report Level. Get Level:" + tc1.ReportLevel.ToString ());
tc1.ReportLevel=Common.GlobalVariables.GlobalLevel;
Report .Info ("Set Report Level. Set Level:" + tc1.ReportLevel.ToString ());
Report .Info ("Error Behavior. Get Error Behavior:" + tc1.ErrorBehavior.ToString ());
-
krstcs
- Ranorex Guru
- Posts: 2683
- Joined: Tue Feb 07, 2012 4:14 pm
- Location: Austin, Texas, USA
Post
by krstcs » Mon May 16, 2016 3:22 pm
The only way to do it in Ranorex Studio would be to make a new UserCode module and then drop it into the SETUP section of each test case where you needed the info.
Shortcuts usually aren't...
-
stapes
- Posts: 206
- Joined: Wed Sep 16, 2015 10:55 am
Post
by stapes » Mon May 16, 2016 4:44 pm
I don't see that SETUP does anything but stick a label on your test report.
I already have this class at the start of every Test Case. I was just wondering if there was an override method I could use to do this.
-
krstcs
- Ranorex Guru
- Posts: 2683
- Joined: Tue Feb 07, 2012 4:14 pm
- Location: Austin, Texas, USA
Post
by krstcs » Mon May 16, 2016 4:58 pm
No, there's no override method for the test cases. If you want to make a feature request, you can send it to
[email protected].
The SETUP and TEARDOWN sections are run regardless of current test status (Success, Failed, etc.). They do label and segregate the test modules inside them so the test cases are a bit easier to read, but the real benefit of them is that they run no matter what the status is.
Shortcuts usually aren't...
-
stapes
- Posts: 206
- Joined: Wed Sep 16, 2015 10:55 am
Post
by stapes » Mon May 16, 2016 5:07 pm
Ah. That is helpful. Thanks.