You need to sign in to do that
Don't have an account?

Test class formula field not covered
Hi,
I am facing issue with my test class where the formula field having return type Boolean is not getting covered even though we have passed the correct data set for old and new values of the record. We have to cover the eligibleforRR(oldWorkOrder,newWorkOrder) , where we are not able to bypass this formula field condition.
@TestVisible private static Boolean isEligibleForRR( WorkOrder oldWo, WorkOrder wo )
{
Boolean isEligible = false;
System.debug(LoggingLevel.WARN, '---> isEligibleForRR; oldWo: ' + oldWo );
System.debug(LoggingLevel.WARN, '---> isEligibleForRR; wo: ' + wo);
if ( wo != null )
{
System.debug(LoggingLevel.WARN, '---> Check Salesforce Assigned Date:' + wo.SalesforceDateAssigned__c );
System.debug(LoggingLevel.WARN, '---> incoming line item count: ' + wo.IncomingWOLineCount__c );
System.debug(LoggingLevel.WARN, '---> Do_Vendor_Assignment__c :' + wo.Do_Vendor_Assignment__c ); FORMULA FIELD with Boolean return type.
System.debug(LoggingLevel.WARN, '---> wo vendor: ' + wo.Vendor__c );
System.debug(LoggingLevel.WARN, '---> dummy vendor: ' + settings.Dummy_Vendor_Id__c );
}
if (wo.Do_Vendor_Assignment__c && DisplayUtils.hasChanged(oldWO, wo, 'Do_Vendor_Assignment__c'))
{
isEligible = true;
}
System.debug(LoggingLevel.WARN, '---> returning isEligible: ' + isEligible);
return isEligible;
}
FORMULA Field : Do_Vendor_Assignment__c
Data TypeFormula
IF (
AND(
LineItemCount = IncomingWOLineCount__c(rool up on WOLI),
Vendor__c = $Setup.Vendor_Assignment_Configs__c.Dummy_Vendor_Id__c(Custom setting),
Has_run_assignment_process__c=FALSE(boolean flag),
ISPICKVAL(WOStatus__c, "Pending Vendor Acceptance") ||
ISPICKVAL(WOStatus__c, "Pending Assignment")
)
, TRUE
, FALSE
)
Can anyone help me increasing the test coverage of my test class and with this issue which is on very high priority at the moment.
Thanks,
Soumya
I am facing issue with my test class where the formula field having return type Boolean is not getting covered even though we have passed the correct data set for old and new values of the record. We have to cover the eligibleforRR(oldWorkOrder,newWorkOrder) , where we are not able to bypass this formula field condition.
@TestVisible private static Boolean isEligibleForRR( WorkOrder oldWo, WorkOrder wo )
{
Boolean isEligible = false;
System.debug(LoggingLevel.WARN, '---> isEligibleForRR; oldWo: ' + oldWo );
System.debug(LoggingLevel.WARN, '---> isEligibleForRR; wo: ' + wo);
if ( wo != null )
{
System.debug(LoggingLevel.WARN, '---> Check Salesforce Assigned Date:' + wo.SalesforceDateAssigned__c );
System.debug(LoggingLevel.WARN, '---> incoming line item count: ' + wo.IncomingWOLineCount__c );
System.debug(LoggingLevel.WARN, '---> Do_Vendor_Assignment__c :' + wo.Do_Vendor_Assignment__c ); FORMULA FIELD with Boolean return type.
System.debug(LoggingLevel.WARN, '---> wo vendor: ' + wo.Vendor__c );
System.debug(LoggingLevel.WARN, '---> dummy vendor: ' + settings.Dummy_Vendor_Id__c );
}
if (wo.Do_Vendor_Assignment__c && DisplayUtils.hasChanged(oldWO, wo, 'Do_Vendor_Assignment__c'))
{
isEligible = true;
}
System.debug(LoggingLevel.WARN, '---> returning isEligible: ' + isEligible);
return isEligible;
}
FORMULA Field : Do_Vendor_Assignment__c
Data TypeFormula
IF (
AND(
LineItemCount = IncomingWOLineCount__c(rool up on WOLI),
Vendor__c = $Setup.Vendor_Assignment_Configs__c.Dummy_Vendor_Id__c(Custom setting),
Has_run_assignment_process__c=FALSE(boolean flag),
ISPICKVAL(WOStatus__c, "Pending Vendor Acceptance") ||
ISPICKVAL(WOStatus__c, "Pending Assignment")
)
, TRUE
, FALSE
)
Can anyone help me increasing the test coverage of my test class and with this issue which is on very high priority at the moment.
Thanks,
Soumya