The retention of foundational knowledge is crucial in learning and teaching mathematics. However, a significant part of university students do not achieve long-term knowledge and problem-solving skills. A possible tool to increase further retention is testing, the strategic use of retrieval to enhance memory. In this study, the effect of a special kind of testing versus worked examples was investigated in an authentic educational setting, in an algebra course for pre-service mathematics teachers. The potential benefits of using tests versus showing students worked examples at the end of each practice session during a semester were examined. According to the results, there was no difference between the effectiveness of the two methods in the medium term—on the midterm that students took on the 6th week and the final that students took on the 13th week of the semester, the testing group performed the same as the worked example group. However, testing was more beneficial regarding long-term retention in studying and solving problems in abstract mathematics. Analyzing the results of the post-test that students took five months after their final test, the authors found that the improvement of those students who learned the material with testing was significantly larger than that of the worked example group. These findings suggest that testing can have a meaningful effect on abstract algebra knowledge and a long-lasting impact on solving complex, abstract mathematical problems.