+ Start a Discussion
Satish PrajapatSatish Prajapat 

how to create test data for big object

Hello Experts,
I have awritten apex class in which is i have used SOQL on Big Object. 
For that I want to write test class but I am not able write the test data for big object.
getting error : unsupported external object operations
List<BigObjectTaskData__b> BigObjectTaskData_ListObject = new List<BigObjectTaskData__b>();
        try{
            
            
            
            BigObjectTaskData__b bObject = new BigObjectTaskData__b();
           // bObject.Id = '0015D000006AsuNQAS';
            bObject.Task_Created_Date__c = System.today();
            bObject.whatId__c = '0015D000006AsuNQAS';
            bObject.Task_Created_By__c =  'Test';
            bObject.whoId__c = '';
            bObject.RecordType__c = 'tests havsc';
            
            bObject.Task_OwnerId__c = '0015D000006AsuNQAS';
            bObject.Task_Status__c = 'test data';
            bObject.Task_Priority__c = 'test data';
            bObject.Task_Due_Date__c = System.today();
            bObject.Task_Subject__c = 'Test Data';
            bObject.Task_Comments__c = 'Test Data';
            
            bObject.Task_Call_Duration__c = 15;
            bObject.Task_Related_Record__c = 'Test Data';
            bObject.Task_Call_Regarding__c = 'Test Data';
            bObject.Task_Result__c = 'Test Data';
            bObject.Task_Reason__c = 'Test Data';
            
            bObject.Task_Last_Modified_date__c = System.today();
            bObject.Task_Last_Modified_by__c = 'test data';
            
            bObject.Task_Owner_name__c = 'Test';
            bObject.Task_parent_Name__c = 'tname';
            bObject.Task_related_to__c = 'leObj';
            
            BigObjectTaskData_ListObject.add(bObject);
//            insert BigObjectTaskData_ListObject;
            database.insertImmediate(BigObjectTaskData_ListObject);
//            Obj1.bigObjectDataList.addAll(BigObjectTaskData_ListObject);
        }
        catch(Exception e)
        {
            System.debug('Exvception : '+e);
        }

Thanks in advance.
NagendraNagendra (Salesforce Developers) 
Hi Satish,

May I suggest you please check with below link from the community with a similar discussion which might help you. Hope this helps.

Thanks,
Nagendra
Raj VakatiRaj Vakati
You can do it two ways 

One : insert the big object into the test class
 
Customer_Interaction__b bo = new Customer_Interaction__b();
bo.Account__c = “001R000000302D3”;
bo.Game_Platform__c = “PC”;
bo.Play_Date__c = “2015-01-01T23:01:01Z”;
bo.In_Game_Purchase__c = “A12569”;
bo.Level_Achieved__c = “41”;
bo.Lives_This_Game__c = “3”;
bo.Score_This_Game__c = “5500”;
bo.Play_Duration__c = “25”;
database.insertImmediate(bo)

Two : Use Stub API of salesforce apex