  An element $g$ of a group $G$ is a test element if every endomorphism of $G$
that fixes $g$ is an automorphism. Let $G$ be a free group of finite rank, an
orientable surface group of genus $n \geq 2$, or a non-orientable surface group
of genus $n \geq 3$. Let $\mathcal{T}$ be the set of test elements of $G$. We
prove that $\mathcal{T}$ is a net. From this result we derive that
$\mathcal{T}$ has positive asymptotic density in $G$. This answers a question
of Kapovich, Rivin, Schupp, and Shpilrain. Furthermore, we prove that
$\mathcal{T}$ is dense in the profinite topology on $G$.
