RecentlyViewed data leakage in unit tests

I have some code that queries RecentlyViewed and needed to be unit tested. I noticed a failure today because more records are turning up than expected.

It turns out that if you query RecentlyViewed in a unit test, even without seeAllData, you still get actual records back. Should this be considered a bug in Apex?


This has now been posted as a Known Issue. See here to click that it affects you:

Source : Link , Question Author : Charles T , Answer Author : Charles T

Leave a Comment