Page 1 of 1

How do i capture module results in variable at runtime

Posted: Wed Apr 24, 2019 12:54 pm
by bhavna.nawani
Hi,

I am new to Ranorex, My project have 1 requirement to create summary report for multiple test execution runs.

The best way to achieve this is by storing test suit results in database (Oracle for e.g.)

However I am unable to figure out on how to capture below basic test results at runtime?
Test Case Name
Module Name
Execution Time stamp
Execution Result

If I am able to capture these values at runtime and store it in a variable then i can pass them to database for storing.

Appreciate quick response as i am currently stuck with this :(

Thanks
Bhavna

Re: How do i capture module results in variable at runtime

Posted: Fri Apr 26, 2019 5:56 am
by Vega
I believe the TestReport class should be able to give you everything you need:
https://www.ranorex.com/Documentation/R ... Report.htm

Example:

Code: Select all

Report.Info("Test case: " + TestSuite.Current.CurrentTestContainer.Name);
Report.Info("Test module: " + TestReport.CurrentTestModuleActivity.TestModuleName);
Report.Info("Result: " + TestReport.CurrentTestModuleActivity.Status.ToString());
Report.Info("Elapsed Time: " + TestReport.CurrentTestModuleActivity.ElapsedTime.ToString());
output:

Code: Select all

Test case: Test_Case_example123 
Test module: Recording1  
Result: Success  
Elapsed time: 143ms  
There are some helpful threads here:
get-name-of-test-module-within-code-t2177.html
where-to-get-the-elapsed-time-for-entre ... 12651.html

hope this helps

Re: How do i capture module results in variable at runtime

Posted: Fri Apr 26, 2019 1:18 pm
by bhavna.nawani
Thank You Vega,

However i have a specific requirement: Refer to attached test suite heirarchy

I need to store test results in variable:
TestCase Name
Test Execution DateTime
Total Elapsed Time for execution
Test Case result
If Failed, then show failed Module Name and error details.

Please let me know how I can capture that and also where should i place my code so that it runs every time even if the Module is failed.

Thanks
Bhavna

Re: How do i capture module results in variable at runtime

Posted: Tue Apr 30, 2019 4:20 am
by Vega
Well if you want your code to execute no matter what, then you would place it in a teardown region for the test case. This way even if the test case passes or fails, your code will always be executed.

Hope this helps

Re: How do i capture module results in variable at runtime

Posted: Thu Mar 25, 2021 10:48 am
by kennethburson
I am new to Ranorex, My project have 1 requirement to create summary to write my essay report for multiple test execution runs. However I am unable to figure out on how to capture below basic test results at runtime?
The most useful link on storing hierarchical data in a relational database: https://www.codeproject.com/Articles/27 ... ierarchies