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:

*Success:

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'");
}
}
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.