Refactor selection_test to use test_common