Generalized Framework for Selectors with Applications in Optimal Group Testing