0
我是一个完整的代码noob,需要帮助编写Salesforce中触发器的测试类。任何帮助将不胜感激。在Salesforce中的触发器上编写测试类
这里是触发:
trigger UpdateWonAccounts on Opportunity(before Update) {
Set <Id> accountIds = new Set <Id>();
//Collect End user Ids which has won Opportunities
for (Opportunity o : Trigger.new) {
if (o.isWon && o.EndUserAccountName__c != null) {
accountIds.add(o.EndUserAccountName__c);
}
}
List <Account> lstAccount = new List <Account>();
//Iterate and collect all the end user records
for (Account a : [Select Id, Status__c From Account where Id IN : accountIds]) {
lstAccount.add(new Account(Id = a.Id, Status__c = true));
}
//If there are any accounts then update the records
if (!lstAccount.isEmpty()) {
update lstAccount;
}
}
你需要编写代码来测试这个特定的触发帮助吗?或者你一般需要帮助创建单元测试课程? – slashingweapon