Page 1 of 1

Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Thu Apr 06, 2017 4:16 pm
by BCTest
Hello,

the variable "totalsuccesscount" from Ranorex 6 in "view.rxlog" changed to "totalsuccesstestcasecount" in Ranorex 7 which now only holds the amount of successfully test-cases.

Ranorex 6:

Code: Select all

var success = parseInt($("#testCasesPie").attr('totalsuccesscount'));
Ranorex 7:

Code: Select all

var success = parseInt($("#testCasesPie").attr('totalsuccesstestcasecount'));
How can we get the old value for both, the successfully performed testcases and -containers?

Regards,
BcTest.

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Fri Apr 07, 2017 3:14 pm
by McTurtle
Hello BcTest,

Taking out the containers seems to have been intended. However, you can still achieve this by code. Below is an example of a code you can call in the the teardown section of the Test Suite.
private int GetSuccessfulTestCases()
		{
			var suite = (TestSuite)TestSuite.Current;
			var entries = suite.GetAllTestSuiteEntries();
			int counter=0;
			
			foreach (var entry in entries)
			{
				var tc = entry as TestCaseNode;
				if (tc != null)
				{
					var status_of_case=tc.Status.ToString();
					if (tc.Checked && !tc.IsRootTestCase && status_of_case=="Success")
					{
						counter=counter+1;
					}
				}
			}
			return counter;
		}
The above code should return you the total number of successful test cases + smart folders. If you wish to exclude smart folders add "&& !tc.IsSmartFolder" into the last "if statement".

Please let me know if this helped.

Regards,
McTurtle

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Fri Apr 07, 2017 3:42 pm
by krstcs
I would suggest making one change to the code. If you don't use a string value, don't change an object to a string. You should check the TestStatus against the actual TestStatus enum.

Code: Select all

include Ranorex.Core.Reporting;

private int GetSuccessfulTestCases()
{
	var suite = (TestSuite)TestSuite.Current;
	var entries = suite.GetAllTestSuiteEntries();
	int counter=0;
	foreach (var entry in entries)
	{
		var tc = entry as TestCaseNode;
		if (tc != null)
		{
			if (tc.Checked && !tc.IsRootTestCase && tc.Status==ActivityStatus.Success)
			{
				counter=counter+1;
			}
		}
	}
	return counter;
}
This allows you to test directly against the ActivityStatus value instead of a string, which is faster and almost always better in the long run.

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Wed May 17, 2017 1:13 pm
by BCTest
Hello McTurtle and krstcs,

your code works fine but I wasn't able to use your code earlier.
Many thanks and apologies.

just another little question:
How can we replace the original variable "totalsuccesstestcasecount" in the report by the new counter?
SuccessTestCount.png
Regards,
BCTest.

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Wed May 17, 2017 1:59 pm
by krstcs
To replace that value in the report you will have to create your own report template.

Honestly, my suggestion would be to move back to 6.2.1 until they fix 7.X so that we can count Smart Folders in the results.

I too have struggled with this issue because we MUST have that count. And the way our tests are setup, it's far easier to stay on 6.2.1 than to have to code around something that should have been there in the first place. So, I'm staying on 6.2.1 until they fix what, to me, is a glaring omission and breaking change. I have several layers of nested test cases and each one must be counted in the result because they are each important (or I wouldn't have put them in there!).

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Wed May 17, 2017 2:58 pm
by BCTest
krstcs wrote:I too have struggled with this issue because we MUST have that count. And the way our tests are setup, it's far easier to stay on 6.2.1 than to have to code around something that should have been there in the first place. So, I'm staying on 6.2.1 until they fix what, to me, is a glaring omission and breaking change. I have several layers of nested test cases and each one must be counted in the result because they are each important (or I wouldn't have put them in there!).
+1

Indeed we have the same problem. We guarantee our management and customers the quality of a release by counting the successful testcases. This number broke from 30k to 600.
It should be possible to count the testcases or testcontainers (or however they'll be named) in the same manner as before.
Do you know if a feature request was sent to Ranorex?

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Thu May 18, 2017 12:13 pm
by Support Team
Hello everyone,

The change from nested test cases to having only one test case in the hierarchy allowed was intentional. Having a number of test cases that are nested has resulted in an incorrect counting.

For example, if your test suite was made of a test case inside a test case and only one recording module under that, then under version 6.2.1 this would mean 2 successful test cases, which is incorrect since only 1 recording was executed.

If you would like to see a “Test container - testresult diagram” in the report, then I would encourage you to create a Ranorex User Voice entry on our User Voice platform. Via the Ranorex User Voice you can submit your feature requests and have the community evaluate it by voting. The most voted-for ideas will get considered for implementation. You can find the Ranorex User Voice platform at the following link: Ranorex User Voice

Sincerely,
Tomaž

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Fri May 19, 2017 9:44 am
by BCTest

Re: Ranorex 7: Equivalent to "totalsuccesscount"

Posted: Mon Sep 11, 2017 12:41 pm
by Product Management
Hello everybody,

thanks for your comments. We take your feedback very seriously. That is why we have decided to restore the counting of the attributes "totalsuccesscount", "totalfailedcount" and "totalblockedcount" in the report.
With the upcoming version Ranorex 7.2 your test cases and smart folders are counted together and are reflected in these attributes again. However the pie chart shows the result of test cases only.

How to adapt the pie chart?
If you want to adapt the pie chart as well, you need to use a custom report template.
After you have created your custom report template, replace the PIECHAR section in the RanorexReport.xml file with the following lines of xml:

Code: Select all

                <!-- PIECHART -->
                <xsl:if test="not(@testentry-activity-type = 'testmodule')">
                  <h3 id="testCasesHeader">Test case result summary</h3>
                  <div id="testCasesPie">
                    <xsl:attribute name="totalsuccesstestcasecount">
                      <xsl:value-of select="@totalsuccesscount" />
                    </xsl:attribute>
                    <xsl:attribute name="totalfailedtestcasecount">
                      <xsl:value-of select="@totalfailedcount" />
                    </xsl:attribute>
                    <xsl:attribute name="totalblockedtestcasecount">
                      <xsl:value-of select="@totalblockedcount" />
                    </xsl:attribute>
                  </div>
                </xsl:if>
This feature will be delivered with the next Ranorex 7.2 release. If you can't wait to check it out, join the Ranorex Beta Program!

Kind regards,
Ranorex Product Management Team