You need to sign in to do that
Don't have an account?
Dean Blanch
I have validated and tested my trigger "Number of Contacts" and it has 7! failures, can anyone help identify how to get passed this stage please.
THE CODE USED
trigger NumberOfContacts on Contact (after insert) {
set<id> setid = new set<id>();
list<account> listaccount = new list<account>();
for(contact con : trigger.new){
setid.add(con.accountid);
}
For(account acc : [select id,name,Number_of_Contacts__c, (select id from contacts)from account where id=:setid]) {
Account ac1 = new account();
ac1.id=acc.id;
ac1.Number_of_Contacts__c= acc.contacts.size();
listaccount.add(ac1);
}
The ITEST CODE
@istest
02public class testnumberofcontacts {
03 @istest static void checknumbers(){
04 test.starttest();
05 account testaccount = new account(name = 'Test account');
06 insert testaccount;
07 contact testcontact = new contact(lastname = 'Samplename', accountid = testaccount.Id);
08 insert testcontact;
09 test.stopTest();
10 list<account> queriedaccount = [select name, number_of_contacts__C from account where id =: testaccount.Id];
11 decimal resultcount;
12 for(account a: queriedaccount){
13 resultcount = a.Number_of_contacts__c;
14 }
15 system.assertEquals(1, resultcount);
16 }
17
18}
THE 7! FAILURES
CMBatchCampaignStatsTesttest_LinkedCampaignsSystem.AssertException: Assertion Failed: Expected: 25, Actual: null
Stack Trace: Class.wbsendit.CMBatchCampaignStatsTest.test_LinkedCampaigns: line 58, column 1
CMBatchCampaignStatsTesttest_LinkedCampaigns_doRun_UpdateOnSystem.AssertException: Assertion Failed: Expected: 25, Actual: null
Stack Trace: Class.wbsendit.CMBatchCampaignStatsTest.test_LinkedCampaigns_doRun_UpdateOn: line 93, column 1
CMBatchCampaignTesttest_addMissingMemberStatusesSystem.AssertException: Assertion Failed: Expected: 3, Actual: 1
Stack Trace: Class.wbsendit.CMBatchCampaignTest.test_addMissingMemberStatuses: line 212, column 1
DisconnectControllerTesttest_Savewbsendit.fflib_SecurityUtils.CrudException: You do not have permission to update Campaign. See: http://support.beaufort12.com/customer/en/portal/articles/2819881
Stack Trace: Class.wbsendit.fflib_SecurityUtils.checkObjectIsUpdateable: line 413, column 1 Class.wbsendit.fflib_SecurityUtils: line 272, column 1 Class.wbsendit.DisconnectController.disconnect: line 26, column 1 Class.wbsendit.DisconnectControllerTest.test_Save: line 32, column 1
LinkCampaignControllerTesttest_autoCreateSalesforceCampaignswbsendit.fflib_SecurityUtils.CrudException: You do not have permission to insert Campaign. See: http://support.beaufort12.com/customer/en/portal/articles/2819881
Stack Trace: Class.wbsendit.fflib_SecurityUtils.checkObjectIsInsertable: line 388, column 1 Class.wbsendit.fflib_SecurityUtils: line 137, column 1 Class.wbsendit.LinkCampaignController.autoCreateSalesforceCampaigns: line 191, column 1 Class.wbsendit.LinkCampaignControllerTest.test_autoCreateSalesforceCampaigns: line 78, column 1
LinkCampaignControllerTesttest_SaveSystem.AssertException: Assertion Failed: Same value: null
Stack Trace: Class.wbsendit.LinkCampaignControllerTest.test_Save: line 38, column 1
ReportToListBatchTesttest_doReportToBatchSystem.LimitException: reports:Too many query rows: 50001
Stack Trace: External entry point Class.wbsendit.ReportToListBatch.getNumberOfRows: line 469, column 1 Class.wbsendit.ReportToListBatch.doStart: line 142, column 1 Class.wbsendit.ReportToListBatch.start: line 48, column 1
trigger NumberOfContacts on Contact (after insert) {
set<id> setid = new set<id>();
list<account> listaccount = new list<account>();
for(contact con : trigger.new){
setid.add(con.accountid);
}
For(account acc : [select id,name,Number_of_Contacts__c, (select id from contacts)from account where id=:setid]) {
Account ac1 = new account();
ac1.id=acc.id;
ac1.Number_of_Contacts__c= acc.contacts.size();
listaccount.add(ac1);
}
The ITEST CODE
@istest
02public class testnumberofcontacts {
03 @istest static void checknumbers(){
04 test.starttest();
05 account testaccount = new account(name = 'Test account');
06 insert testaccount;
07 contact testcontact = new contact(lastname = 'Samplename', accountid = testaccount.Id);
08 insert testcontact;
09 test.stopTest();
10 list<account> queriedaccount = [select name, number_of_contacts__C from account where id =: testaccount.Id];
11 decimal resultcount;
12 for(account a: queriedaccount){
13 resultcount = a.Number_of_contacts__c;
14 }
15 system.assertEquals(1, resultcount);
16 }
17
18}
THE 7! FAILURES
CMBatchCampaignStatsTesttest_LinkedCampaignsSystem.AssertException: Assertion Failed: Expected: 25, Actual: null
Stack Trace: Class.wbsendit.CMBatchCampaignStatsTest.test_LinkedCampaigns: line 58, column 1
CMBatchCampaignStatsTesttest_LinkedCampaigns_doRun_UpdateOnSystem.AssertException: Assertion Failed: Expected: 25, Actual: null
Stack Trace: Class.wbsendit.CMBatchCampaignStatsTest.test_LinkedCampaigns_doRun_UpdateOn: line 93, column 1
CMBatchCampaignTesttest_addMissingMemberStatusesSystem.AssertException: Assertion Failed: Expected: 3, Actual: 1
Stack Trace: Class.wbsendit.CMBatchCampaignTest.test_addMissingMemberStatuses: line 212, column 1
DisconnectControllerTesttest_Savewbsendit.fflib_SecurityUtils.CrudException: You do not have permission to update Campaign. See: http://support.beaufort12.com/customer/en/portal/articles/2819881
Stack Trace: Class.wbsendit.fflib_SecurityUtils.checkObjectIsUpdateable: line 413, column 1 Class.wbsendit.fflib_SecurityUtils: line 272, column 1 Class.wbsendit.DisconnectController.disconnect: line 26, column 1 Class.wbsendit.DisconnectControllerTest.test_Save: line 32, column 1
LinkCampaignControllerTesttest_autoCreateSalesforceCampaignswbsendit.fflib_SecurityUtils.CrudException: You do not have permission to insert Campaign. See: http://support.beaufort12.com/customer/en/portal/articles/2819881
Stack Trace: Class.wbsendit.fflib_SecurityUtils.checkObjectIsInsertable: line 388, column 1 Class.wbsendit.fflib_SecurityUtils: line 137, column 1 Class.wbsendit.LinkCampaignController.autoCreateSalesforceCampaigns: line 191, column 1 Class.wbsendit.LinkCampaignControllerTest.test_autoCreateSalesforceCampaigns: line 78, column 1
LinkCampaignControllerTesttest_SaveSystem.AssertException: Assertion Failed: Same value: null
Stack Trace: Class.wbsendit.LinkCampaignControllerTest.test_Save: line 38, column 1
ReportToListBatchTesttest_doReportToBatchSystem.LimitException: reports:Too many query rows: 50001
Stack Trace: External entry point Class.wbsendit.ReportToListBatch.getNumberOfRows: line 469, column 1 Class.wbsendit.ReportToListBatch.doStart: line 142, column 1 Class.wbsendit.ReportToListBatch.start: line 48, column 1
From the error screenshot i can understand that these 7 errors are not from the mentioned test class. Second, from error 4 and 5 i can understand that you have some access privileage with Campaigns object.
Yuvaraj
Cheers