微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

由于不相关的测试类,入站更改集失败有人可以提供有关为什么会这样的任何见解吗?

如何解决由于不相关的测试类,入站更改集失败有人可以提供有关为什么会这样的任何见解吗?

我正在尝试在我的生产 Salesforce 环境中为学生注册触发器部署和入站更改集,但由于不相关的测试类而失败。错误如下:

System.EmailException:SendEmail 失败。第 0 行的第一个异常;第一个错误:INSUFFICIENT_ACCESS_OR_READONLY,未配置访问此组织范围的电子邮件地址:[] 堆栈跟踪:Class.TrainerReportEmailer.sendReports:第 79 行,第 1 列 Class.TrainerReportEmailer.execute:第 22 行,第 1 列 Class.TestTrainertextReportEmailer.sendReports 85,第1列

我已更新引用的组织范围电子邮件地址,确保将地址设置为“允许所有配置文件”,并且我已检查关联用户的访问/权限,但错误仍然存​​在。以下是我的测试类特定于错误中报告的行的代码

第 11-22 行:

static void init() {

    contactList = new List<Contact>();
    courseList = new List<Course__c>();
    
    contactList.add(new Contact(
        FirstName = '.....',LastName = '.....',Email = '.............',Contact_Type__c = 'Certified',drupal_password_reset_link__c='https://www.valuescentre.com/myctt/password'
    ));

第 55-80 行:

insert opList;
opList = [select Name,StageName,Drupal_Id__c,Consultant__c,CloseDate from Opportunity where id=:opList[0].Id];


studentIdList = new List<Id>();
srList = new List<Student_Registration__c>();
srList.add(new Student_Registration__c (
    status__c = 'Certified',certified_date__c = System.today().addMonths(-1),Student__c = contactList[0].Id,cert__c = 'Part 1',Course_Opportunity__c = opList[0].Id,Course__c = courseList[0].Id
));
insert srList;
srList = [Select Student__r.Id,cert__c,certified_date__c,course__r.name,Course_Opportunity__r.name,Course_Opportunity__r.Trainer_Instructor__c from Student_Registration__c where status__c='Certified' and certified_date__c != null and certified_date__c > :Date.today().addDays(-365)];

for(Student_Registration__c sr : srList) {
    System.debug('sr ' + sr.Student__r.Id);
    studentIdList.add(sr.Student__r.Id);
}

contactsCertifiedThisYear =  [Select Id,Name,Email,Part_Two_Free_Assessment_Date__c,Part_One_Free_Assessment_Date__c,Part_One_Trained_By__c,Part_One_Trained_By__r.name,Part_Two_Trained_By__c,Part_Two_Trained_By__r.name,Part_One_Cert_Date__c,Part_Two_Cert_Date__c,Part_One_Course__r.name,Part_Two_Course__r.name,First_Paid_Assessment_Date__c,(Select cert__c,Course_Opportunity__r.Trainer_Instructor__c,isRetake__c from Student_Registration__r where status__c='Certified') from Contact where id in :studentIdList order by Part_Two_Cert_Date__c,Part_One_Cert_Date__C desc];
}

第 81-88 行:

static testMethod void textExecute() {
    Test.starttest();
      init();
      TrainerReportEmailer tMailer = new TrainerReportEmailer();
      tMailer.execute(null);
    Test.stoptest();
  }
  

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。