function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vino2vijayvino2vijay 

No more than one executeBatch can be called from within a test method

HI All,

I have written testmethod with including annotation (Seealldata=true), 3 Weeks back its working fine ... But now we r getting some issue  (No more than one executeBatch can be called from within a test method).

 

In google most of them says .. before start the process please delete all the records from the Object .. If i delete the records from the object ? whether it will be affecting Original records OR not  ?

 

 

Thanks in Advance,

Vinoth

 

souvik9086souvik9086

You can remove SeeAllData=True then it will work fine. Any special reason for that visibling Alldata? You can create the datas in test method instead of that.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

vino2vijayvino2vijay

I have already tried , what u have suggested it will not resolve the issue .. i mean it will not cover the execute method from batch class :( ... thats the only reason  i have included (Seealldata=true). by the way i m using standard object history ...
Can u please let me know if i delete the records from the object whether it will be affecting the Original object records ?

 

souvik9086souvik9086

Through testmethod the DML which occured are not commited in the database. So it doesn't affect real object data.

Use test.startTest() and test.stopTest() as well there.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

vino2vijayvino2vijay

Okie Fine :) Let me try this and let u know .....

 

Thank you