I've a simple apex class as below.
public class ChildParentRecords {
@AuraEnabled
public static void getDta() {
String createChild='SELECT Id, Name FROM Account LIMIT 1';
List<Sobject> children = Database.query(createChild);
System.debug(children.size());
}
}
And I wrote a test class for the same as below.
@isTest
public with sharing class GetChildAndParentsTest {
static testMethod void testgetRelDets(){
String createChild='SELECT Id, Name FROM Account LIMIT 1';
List<Sobject> children = Database.query(createChild);
System.assertEquals(1, 1);
}
}
when I am running this test class, it is passed(as I've given 1, 1 in assert Equals), when I go to the code coverage it shows none.
I'm very confused on where I'm going wrong. Please let me know how to fix this.
Thanks
ChildParentRecords.getDta();
Please go through this trail to better understand this. trailhead.salesforce.com/en/content/learn/modules/apex_testing/…