I have tried and finally got one solution to get the preference fragment in to my test class just by overriding onAttachFragment() method of Settings activity.
fragmentsList = new ArrayList<Fragment>();
@Override
public void onAttachFragment(Fragment fragment)
{
fragmentsList.add(fragment);
}
public ArrayList<Fragment> getFragmentsAttachedToActivity()
{
return fragmentsList;
}
Now using getFragmentsAttachedToActivity() you can access all the fragments of settings activity if they are added to to it.