You need to sign in to do that
Don't have an account?
Harsha Shri
Help in test class for updating field method
Hi All,
I need help in test class.
I have written a method for external object that sync all fields when ever I add custom fields into it. I am sharing my code please help me to write a test class for this method
Thank in Advance
I need help in test class.
I have written a method for external object that sync all fields when ever I add custom fields into it. I am sharing my code please help me to write a test class for this method
global class dataSourceCon extends datasource.connection{ override global List<DataSource.Table> method1() { List<DataSource.Table> extObj = new List<DataSource.Table>(); for(ext_obj1__c Obj : [SELECT Id, Name, Description__c, Name_Col__c, Label_Plu__c, Label_Sin__c, (SELECT Id, Name, External_Ta__c, Data_Type__c, Decimal_Places__c, Desc__c, Field_Label__c, Filtera__c, Len__c, ReferenceTarFld__c, RefTo__c, Sort__c FROM External_Col__r ) FROM ext_obj1__c LIMIT 50 ]) { List<DataSource.Column> colu_Obj = new List<DataSource.Column>(); // Standard fields colu_Obj.add(DataSource.Column.url('DisplayUrl')); colu_Obj.add(DataSource.Column.text('ExternalId',255)); //Custom fields for(Exter_Field__c cusField : Obj.External_Col__r) { colu_Obj.add(setupCustomFieldData(cusField)); } // Table Data extObj.add(setupTableData(Obj, colu_Obj)); } return extObj; } }Please help me in writing test class for this. I am new to test class and I am struggling
Thank in Advance
Try this, Regards,
Gokula Krishnan
If it helps you, please mark is as best answer, so it will be helpful for other developers.
All Answers
Try this, Regards,
Gokula Krishnan
If it helps you, please mark is as best answer, so it will be helpful for other developers.
You need to create Test Data into Test class you can not use SeeAllData to true . Do insert the test data into the test class and then Call you class method using the above code.