Improves the selection algorithm for test directories