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

Struggle with deployment: interfering class (Too many SOQL queries 101)
Hi all,
Developing a few triggers in our sandbox, I was about to get them deployed into our live org (100% coverage, all clean and good in test). However, in the live org, I always run into a conflict of "Too many SOQL queries 101". I have tried to bulkify my triggers (e.g. on queries in for loops etc) and eventually realized, it all comes down to a test class that someone else previously developed. In said test class, two methods cause the exceptions. My intention now is to 1) either clean up this test class OR 2) temporarily "deactivate" it to upload my triggers (not the preferred way).
To stick to no. 1, do you know what I need to consider in the below test class?
Many thanks in advance and best regards,
Daniel
Developing a few triggers in our sandbox, I was about to get them deployed into our live org (100% coverage, all clean and good in test). However, in the live org, I always run into a conflict of "Too many SOQL queries 101". I have tried to bulkify my triggers (e.g. on queries in for loops etc) and eventually realized, it all comes down to a test class that someone else previously developed. In said test class, two methods cause the exceptions. My intention now is to 1) either clean up this test class OR 2) temporarily "deactivate" it to upload my triggers (not the preferred way).
To stick to no. 1, do you know what I need to consider in the below test class?
Many thanks in advance and best regards,
Daniel
@isTest private class IntegrationQueueTrigger_TEST { static testUtils util = new testUtils(); //////////////////////////////////////////////////////////////////////////////////////////////////// @isTest static void Insert_IPs() { Test.startTest(); List<Contact> ips = new List<Contact>(); ips = util.createTestIpProjectStack(1, 'Test'); List<Integration_Queue__c> items = new List<Integration_Queue__c>(); Integration_Queue__c item = new Integration_Queue__c(); item.Type__c = sapIntegrationUtils.IP_INTEGRATION_NAME; item.Item_Id__c = ips[0].id; items.add(item); insert items; Test.stopTest(); } //////////////////////////////////////////////////////////////////////////////////////////////////// @isTest static void Insert_CAs() { Test.startTest(); // Implement test code List<Contact> ips = new List<Contact>(); ips = util.createTestIpProjectStack(1, 'Test'); List<Integration_Queue__c> items = new List<Integration_Queue__c>(); Integration_Queue__c item = new Integration_Queue__c(); // get the account back (via placements) for this IP Account a = new Account(); a.id = [Select id, ts2__Project__r.ts2__Client__c FROM ts2__Placement__c WHERE ts2__Employee__c =: ips[0].id].ts2__Project__r.ts2__Client__c; item.Type__c = sapIntegrationUtils.CA_INTEGRATION_NAME; item.Item_Id__c = a.id; items.add(item); insert items; Test.stopTest(); } }
The trigger in question is the following:
The errors I get when validating the trigger in production are:
IntegrationQueueTrigger_TEST Insert_CAs System.LimitException: Too many SOQL queries: 101
Stack Trace: Class.testUtils.createTestApplications: line 212, column 1 Class.testUtils.createTestIpProjectStack: line 136, column 1 Class.IntegrationQueueTrigger_TEST.Insert_CAs: line 29, column 1
IntegrationQueueTrigger_TEST Insert_IPs System.LimitException: Too many SOQL queries: 101
Stack Trace: Class.testUtils.createTestApplications: line 212, column 1 Class.testUtils.createTestIpProjectStack: line 136, column 1 Class.IntegrationQueueTrigger_TEST.Insert_IPs: line 10, column 1