• randheer practise
  • NEWBIE
  • 29 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 6
    Replies
Am inserting 1000 records to Task object, as per the trigger functionality it splits in 200 and inserts/updates the records. During this insertion 5 batches splits up and running concurrently this is causing some failures in batches. So i need to create list of 1000 records during insert in the trigger and call the batch apex for single time kindly help me very urgent
Why to use (SeeAllData == true) in Test class?
DeleteDMl class
public class DeleteDml {
    public void accountInserting(){
        //fetching old records with name kanus
        List<Account> accounts =[SELECT id,name from Account WHERE name='kanus'];
        try{
        delete accounts;
        }catch(Exception e){
            system.debug('records are not deleted');
            
        }
    }
}

testclass
@istest
public class DeleteDML_test {
    public static testMethod Account insertingAccount(){
        test.startTest();
        Account a = new Account();
        a.Name='kanus';
        insert a;
        DeleteDml d = new DeleteDml();
        d.accountInserting();
        Test.stopTest();
        return a;
       
    }
    public static testMethod void Method2(){
      Test.startTest();
        Account a1=insertingAccount();
        Account a2=[SELECT id,name FROM Account WHERE name='kanus123'];
        try{
            delete a2;
        }catch(Exception e){
            system.debug('no record with name kanus123');
        }
        
        test.stopTest();
         DeleteDml d1 = new DeleteDml();
        d1.accountInserting();
    }
}