Is it possible to get the run status of a Test Module by name

Ask general questions here.
Posts: 5
Joined: Wed May 22, 2019 2:25 am

Is it possible to get the run status of a Test Module by name

Post by gmaroli » Thu Aug 29, 2019 6:08 am

Using Ranorex9.1

I have the following structure for a test:

-- Module1

I need to check if the Module 2 has passed and only then execute Module 3.
One way is to set the Error Behavior at Test Case level to Continue with Sibling -- I cannot use this as i want to run this test for multiple data sets
Another way which i can think of is by setting a Global Parameter and binding it to Module 2 and Module 3

Is there any other method that i can use to get or set the status of a Module by passing the module name as the argument?

Posts: 26
Joined: Wed Oct 17, 2018 11:15 am
Location: Zlin, CR

Re: Is it possible to get the run status of a Test Module by name

Post by kOoO » Thu Aug 29, 2019 9:36 am

What you are trying to do is default behaviour of Ranorex, isn't it?

When module2 fails, module3 gets never executed (even if "Error Behaviour" of containing Test Case is set to "Continue with Sibling", because it has nothing to do with its children). Unless module3 is in teardown - in that case it gets executed always.

Or you can play with ActivityStack.

For example:

Code: Select all

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Repository;
using Ranorex.Core.Testing;

namespace MyTest3
    public partial class RecordingSuccess
        public void asd()

        public bool ActivityStackVisitor(Ranorex.Core.Reporting.Activity activity ){
        	if(activity.GetType().Name == "TestModuleActivity"){
        		Ranorex.Core.Reporting.TestModuleActivity act = (Ranorex.Core.Reporting.TestModuleActivity) activity;

        		if(act.FullDisplayName == "module2"){
        			//DO YOUR LOGIC
        			if(act.Status == Ranorex.Core.Reporting.ActivityStatus.Success){
        				Ranorex.Report.Info("module2 was success");
        				Ranorex.Report.Info("module2 was failure");
        	return true;