TestReport.CurrentTestSuiteActivity.Status misunderstanding

Best practices, code snippets for common functionality, examples, and guidelines.
bygones
Posts: 31
Joined: Fri Nov 27, 2015 11:32 am

TestReport.CurrentTestSuiteActivity.Status misunderstanding

Post by bygones » Mon Nov 30, 2015 1:43 pm

Hi,

I have a TestSuite with one TestCase failing and I have a "plugin" (not sure how you call it in ranorex - a built cs file) at the end that is reading the status of the test execution.

Code: Select all

TestReport.CurrentTestCaseActivity.Status
is returning "Failed" as expected

Code: Select all

TestReport.CurrentTestSuitActivity.Status
is returning "Success" as not expected.

I assumed that the status of the suit is depending on the status of the test cases, or not ?

So why is the suit saying it succeeded ?

Also these methods are marked as "for internal use only", so I assume one should not use them at all ? And what are the alternatives ?

I'm using Ranorex 5.4.3.26106

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: TestReport.CurrentTestSuiteActivity.Status misunderstanding

Post by Support Team » Wed Dec 02, 2015 10:07 am

Hello bygones,

Yes, you are correct that the status of the Test Suite depends on the status of the Test Cases.
At the moment you are trying to read the status of the Test Suite the processing of the Test Suite is not completed. Therefore, the incorrect status is displayed.

These methods shouldn't be used because they are part of our internal API and it is likely that these methods will be changed in the future.

In order to read the status of the completed Test Suite, please follow the steps below:

1) Open Program.cs of your project
2) Implement the following code after the try-catch block

Code: Select all

  //Check Status of Test Suite
  var testSuiteAct =  ActivityStack.Instance.RootActivity.Children[0] as TestSuiteActivity;
  var status =  testSuiteAct.Status;
  Report.Info(status.ToString());
Program_cs.png
Please note that this method is part of our internal API. We do not guarantee for any side-effects and we preserve the right to change our internal methods at any time.

Regards,
Johannes
You do not have the required permissions to view the files attached to this post.

bygones
Posts: 31
Joined: Fri Nov 27, 2015 11:32 am

Re: TestReport.CurrentTestSuiteActivity.Status misunderstanding

Post by bygones » Wed Dec 02, 2015 2:07 pm

thank you for your answer - I'm not sure how to think about it - you are telling that I should not use the first solution, because its internal and can change, but then you suggest another internal method ? There I have the same issue, right ?

Actually, I think in my setting I do like to have the status of a TestCase, so

Code: Select all

TestReport.CurrentTestCaseActivity.Status
is the right way for now.

Nevertheless, as all are internal methods, is there any API method I can use to retrieve the status of a test case ?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: TestReport.CurrentTestSuiteActivity.Status misunderstanding

Post by Support Team » Thu Dec 03, 2015 3:11 pm

Hi bygones,

I suggested another approach because the mentioned method doesn't return the correct Test Suite result.
If you implement my previously described method in Program.cs, you should get the correct result.

Of course you are allowed to use these internal methods if they are needed in your Solution.
I just wanted to mention that these methods could change in the future.

Unfortunately, there is no other way to get the result of the Test Suite.

Regards,
Johannes