Report details not generating if module fails

Ask general questions here.
rezme
Posts: 15
Joined: Thu Feb 20, 2014 8:40 pm

Report details not generating if module fails

Post by rezme » Tue Nov 03, 2015 6:13 pm

First, let me detail our setup. We use ranorex to build libraries of commonly used functions in our software, so as to eliminate creating the same module for suite after suite. We have a series of projects that are all library projects that we build basic functions in, and then reference those libraries in the actual Ranorex project we're building for testing.

My current issue:

One of the test modules will only generate a ranorex report if all the items in it are successful. If anything fails, the module fails but there is no detail in the failure report. If all the items are successful, the report generates fine.

*Failure: Image

*Success: Image

This is a usercode module (code below)

Code: Select all

public void CheckValues()
        {
        	Report.Info("Info","Validating alert template tab");
        	if (!string.IsNullOrEmpty(optvarAlertTemplate) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string AlertTemplateText = repo.InternalMonitorForm.AlertingTab.SelectAlertTemplate.Text;
        		if(AlertTemplateText.ToLower() == optvarAlertTemplate.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.SelectAlertTemplate' (" + AlertTemplateText + ") matches the expected value (" + optvarAlertTemplate + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.SelectAlertTemplate' (" + AlertTemplateText + ") does not match the expected value (" + optvarAlertTemplate + ")");
        		}
        	}
        	else
        	{
    			Report.Info("Skipped item","Not validating 'InternalMonitorForm.AlertingTab.SelectAlertTemplate'");
        	}
        	
        	if (!string.IsNullOrEmpty(optvarSuccessSubject) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string SuccessSubjectText = repo.InternalMonitorForm.AlertingTab.AlertSubjectOnSuccess.TextValue;
        		if(SuccessSubjectText.ToLower() == optvarSuccessSubject.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertSubjectOnSuccess' (" + SuccessSubjectText + ") matches the expected value (" + optvarSuccessSubject + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertSubjectOnSuccess' (" + SuccessSubjectText + ") does not match the expected value (" + optvarSuccessSubject + ")");
        		}
        	}
        	else
        	{
        		Report.Info("Skipped item","Not validating 'InternalMonitorForm.AlertingTab.AlertSubjectOnSuccess'");
        	}
        	
        	if (!string.IsNullOrEmpty(optvarSuccessMessage) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string SucessMessageText = repo.InternalMonitorForm.AlertingTab.AlertMessageOnSuccess.TextValue;
        		if(SucessMessageText.ToLower() == optvarSuccessMessage.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertMessageOnSuccess' (" + SucessMessageText + ") matches the expected value (" + optvarSuccessMessage + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertMessageOnSuccess' (" + SucessMessageText + ") does not match the expected value (" + optvarSuccessMessage + ")");
        		}
        	}
        	else
        	{
        		Report.Info("Skipped item","Not validating 'InternalMonitorForm.AlertingTab.AlertMessageOnSuccess'");
        	}
        	
        	if (!string.IsNullOrEmpty(optvarFailureSubject) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string FailureSubjectText = repo.InternalMonitorForm.AlertingTab.AlertSubjectOnFailure.TextValue;
        		if(FailureSubjectText.ToLower() == optvarFailureSubject.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertSubjectOnFailure' (" + FailureSubjectText + ") matches the expected value (" + optvarFailureSubject + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertSubjectOnFailure' (" + FailureSubjectText + ") does not match the expected value (" + optvarFailureSubject + ")");
        		}
        	}
        	else
        	{
        		Report.Info("Skipped item","Not validating 'InternalMonitorForm.AlertingTab.AlertSubjectOnFailure'");
        	}
        	
        	if (!string.IsNullOrEmpty(optvarTicketCategory) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string TicketCategoryText = repo.InternalMonitorForm.AlertingTab.TicketCategory.Text;
        		if(TicketCategoryText.ToLower() == optvarTicketCategory.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.TicketCategory' (" + TicketCategoryText + ") matches the expected value (" + optvarTicketCategory + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.TicketCategory' (" + TicketCategoryText + ") does not match the expected value (" + optvarTicketCategory + ")");
        		}
        	}
        	else
        	{
        		Report.Info("Skipped item","Not validating 'repo.InternalMonitorForm.AlertingTab.TicketCategory'");
        	}
        	
        	if (!string.IsNullOrEmpty(optvarScriptToRun) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string ScriptToRunText = repo.InternalMonitorForm.AlertingTab.ScriptToRun.Text;
        		if(ScriptToRunText.ToLower() == optvarScriptToRun.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.ScriptToRun' (" + ScriptToRunText + ") matches the expected value (" + optvarScriptToRun + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.ScriptToRun' (" + ScriptToRunText + ") does not match the expected value (" + optvarScriptToRun + ")");
        		}
        	}
        	else
        	{
        		Report.Info("Skipped item","Not validating 'InternalMonitorForm.AlertingTab.ScriptToRun'");
        	}
        	
        	//Causes module to not report details upon failure if not commented out
        	if (!string.IsNullOrEmpty(optvarReportCategory) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string ReportCategoryText = repo.InternalMonitorForm.AlertingTab.ReportCategory.Text;
        		if(ReportCategoryText.ToLower() == optvarReportCategory.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.ReportCategory' (" + ReportCategoryText + ") matches the expected value (" + optvarReportCategory + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.ReportCategory' (" + ReportCategoryText + ") does not match the expected value (" + optvarReportCategory + ")");
        		}
        	}
        	else
        	{
    			Report.Info("Skipped item","Not validating 'InternalMonitorForm.AlertingTab.ReportCategory'");
        	}
        	
        	//Causes module to not report details upon failure if not commented out
        	if (!string.IsNullOrEmpty(optvarFailureMessage) | boolValidateBlankFields.ToLower() == "true")
        	{
        		string FailureMessageText = repo.InternalMonitorForm.AlertingTab.AlertMessageOnFailure.TextValue;
        		if(FailureMessageText.ToLower() == optvarFailureMessage.ToLower())
        		{
        			Report.Success("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertMessageOnFailure' (" + FailureMessageText + ") matches the expected value (" + optvarFailureMessage + ")");
        		}
        		else
        		{
        			Report.Failure("Validation","Value in 'InternalMonitorForm.AlertingTab.AlertMessageOnFailure' (" + FailureMessageText + ") does not match the expected value (" + optvarFailureMessage + ")");
        		}
        	}
        	else
        	{
        		Report.Info("Skipped item","Not validating 'InternalMonitorForm.AlertingTab.AlertMessageOnFailure'");
        	}
        }
Variable names starting with "opt" are optional variables that the module's execution is not dependent upon, variable names starting with "bool" are boolean, and the only proper values to be used in those variables are "true" or "false".

I've tried the following:
  • Commented out "if" statements one by one to identify the ones that are causing problems. I've detailed the ones that caused the module to break above in comments

    Created a completely new recording module, and rewrote the code from scratch.

    Re-tracked the repo items referenced in the code

    Put in logging to output to a text file in real-time (the writes to the text file occurred as expected throughout the module's execution, despite the fact that the module failed and showed no results)

    Manually changed the value of the item that was failing validation to the correct value (This resulted in the test completing successfully, and the module in question reporting its actions without issue)

    "Cleaned" project

    Rebooted

    Run the code module in the original library project (successfully ran)

    Moved all code that accessed attributes of a .NET control to the top of each if statement to avoid accessing it multiple times (i.e. when reporting the value present in a control in a ranorex "report.X" statement)

    Put the application into the same state it would be just prior to this module executing, disabled all other steps in the test case, and ran it by itself.
I'm about out of things to try. I'll gladly send a snapshot if I can get instructions, but not sure if that will help because the issue lies in a module that resides in a library dll, so I'm not sure if your ranorex snapshot will include details on external library dll files.

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

Re: Report details not generating if module fails

Post by Support Team » Fri Nov 06, 2015 12:40 pm

Hello rezme,

In order to analyze the issue I would need more detailed information.
May I ask which version of Ranorex you currently use?

Additionally, it would be great if you could upload your compressed Ranorex Solution and the corresponding library project.
If you don't want to upload the solution to the forum, you could also contact [email protected] directly.
This would help me analyzing the issue.

Thank you in advance.

Regards,
Johannes