R.id.test_fragment
is not the ID of your fragment but the id of your LinearLayout
Calling add(int containerViewId, Fragment fragment)
will add a fragment without a tag.
So or you use add(int containerViewId, Fragment fragment, String tag)
and you get back your fragment using your tag (as an ID)