There is no universally optimal test strategy for composite hypotheses (unknown parameters in the pdfs). The generalized likelihood ratio test (GLRT) is a likelihood ratio in which the unknown parameters are replaced by their maximum likelihood estimates. Example of the GLRT for detecting a signal of known shape but unknown amplitude in noise of unknown variance.