  We elaborate the theory of the stable Bernstein center of a $p$-adic group
$G$, and apply it to state a general conjecture on test functions for Shimura
varieties due to the author and R. Kottwitz. This conjecture provides a
framework by which one might pursue the Langlands-Kottwitz method in a very
general situation: not necessarily PEL Shimura varieties with arbitrary level
structure at $p$. We give a concrete reinterpretation of the test function
conjecture in the context of parahoric level structure. We also use the stable
Bernstein center to formulate some of the transfer conjectures (the
"fundamental lemmas") that would be needed if one attempts to use the test
function conjecture to express the local Hasse-Weil zeta function of a Shimura
variety in terms of automorphic $L$-functions.
