A nonzero element a of an algebra A is called a test element if for any endomorphism φ of A it follows from φ(a)=a that φ is an automorphism of the algebra A. A subalgebra B of A is a retract if there is an ideal I of A such that A=B ⊕ I. We consider the main types of free algebras with the Nielsen–Schreier property: free nonassociative algebras, free commutative and anti-commutative nonassociative algebras, free Lie algebras and superalgebras, and free Lie p-algebras and p-superalgebras. For any free algebra F of finite rank of such type we prove that an element u is a test element if and only if it does not belong to any proper retract of F. Test elements for monomorphisms of F are exactly elements that are not contained in proper free factors of F. These results give analogs of Turner's results on test elements of free groups. We also characterize retracts of the algebra F. We prove that if some endomorphism φ preserve the automorphic orbit of some nonzero element of F, then φ is a monomorphism. For free Lie algebras and superalgebras over a field of characteristic zero and for free Lie p-(super)algebras over a field of prime characteristic p we show that in this situation φ is an automorphism. We discuss some related topics and formulate open problems.