• klaus maier
  • NEWBIE
  • 20 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hey guys,
i wonder which IDE do you use for salesforce development. At the moment i am using visual stuido code which is much better than the developer console. Yesterday i found "welkinsuite" which looks pretty nice. Especially the feature to test the efficiency of classes and methods looks pretty awesome. I want to test it, but maybe some of you have already used it.

So, which ide you prever and why ?
Hello guys,
as best practice i want to bulkyify my triggers and class methodes as good as poosible. How many records do i have to create/test to call a bulk test ? If i create a lot of test data in my @testsetup method i am running into the cpu limit.

For example. A method queries the Opportunity.AccountId of some specific opportunitylineitems and put them in a set of ids. To test this method, i have to create x Accounts with x  (min 1) opportunities and x (min 1) opportunitylineitems. 

So my questions:
- how many records do you use in your testclasses ? per object and overall
- is it best practice to use Test.startTest() and Test.stopTest() in the testsetup method ?

 
Hello guys,

i wonder if there is a way to avoid the for loop and make the query more efficient. I still want to query the line items and get a set of account ids.
Is it possible to get a map like <parent.id, opportunityLineItem>  ?
public static Set<Id> runningMemberships (Date dateField){
        Set<Id> idSet = new Set<Id> ();

        List<OpportunityLineItem> oliList = [
            SELECT Id, Opportunity.AccountId
            FROM OpportunityLineItem
            WHERE Opportunity.IsWon = true
            AND Opportunity.start__c <= :dateField
            AND Opportunity.end__c >= :dateField
            AND family__c = 'membership''
            LIMIT 50000
        ];

        for (OpportunityLineItem oli : oliList) {
            idSet.add(oli.Opportunity.AccountId);
        }
        return idSet;
    }
Greetings,

Klaus
 
Hello guys,
as best practice i want to bulkyify my triggers and class methodes as good as poosible. How many records do i have to create/test to call a bulk test ? If i create a lot of test data in my @testsetup method i am running into the cpu limit.

For example. A method queries the Opportunity.AccountId of some specific opportunitylineitems and put them in a set of ids. To test this method, i have to create x Accounts with x  (min 1) opportunities and x (min 1) opportunitylineitems. 

So my questions:
- how many records do you use in your testclasses ? per object and overall
- is it best practice to use Test.startTest() and Test.stopTest() in the testsetup method ?

 
Hello guys,

i wonder if there is a way to avoid the for loop and make the query more efficient. I still want to query the line items and get a set of account ids.
Is it possible to get a map like <parent.id, opportunityLineItem>  ?
public static Set<Id> runningMemberships (Date dateField){
        Set<Id> idSet = new Set<Id> ();

        List<OpportunityLineItem> oliList = [
            SELECT Id, Opportunity.AccountId
            FROM OpportunityLineItem
            WHERE Opportunity.IsWon = true
            AND Opportunity.start__c <= :dateField
            AND Opportunity.end__c >= :dateField
            AND family__c = 'membership''
            LIMIT 50000
        ];

        for (OpportunityLineItem oli : oliList) {
            idSet.add(oli.Opportunity.AccountId);
        }
        return idSet;
    }
Greetings,

Klaus