Given a discrete-valued sample X<sub>1,</sub>...,X<sub>n</sub> we wish to test whether it was generated by a stationary ergodic process belonging to a family H<sub>0</sub>, or it was generated by a stationary ergodic process outside H<sub>0</sub>. Apart from the assumptions of stationarity and ergodicity, no further probabilistic or parametric assumptions are made. We require the Type I error of the test to be uniformly bounded, while the probability of Type II error has to tend to zero as the sample size increases. For this notion of consistency we provide necessary and sufficient conditions on the family H<sub>0</sub> for the existence of a consistent test. This criterion is illustrated with applications to testing for a membership to parametric families, generalizing some existing results.