+ Start a Discussion

Test method fails to get FeedItem of Type TrackChanged

Hi ,


I have test method where i try to get the Feeditem of type trackedChange which is automatically created when we update a field value that is being tracked via feedTracking. But the test method is not able to get that feedItem record. Even tried with lowering the version, but no results. Can someone help?

Following is the testmethod: -

static testmethod void mytest(){
        Account acc = new Account(Name = 'TestAccountBhushan',Phone = '040-754-7845');
        insert acc;        
        acc.Phone = '040-123-4567';            
        update acc;      
        List<FeedItem > txtFeedItem = [SELECT Id,
               ParentId FROM FeedItem Where ParentId=: acc.Id];
               System.assertEquals(1, txtFeedItem.size());