Search-based test generation is guided by feedback from one or more fitness functions - scoring functions that judge solution optimality. Choosing informative fitness functions is crucial to meeting the goals of a tester. Unfortunately, many goals - such as forcing the class-under-test to throw exceptions, increasing test suite diversity, and attaining Strong Mutation Coverage - do not have effective fitness function formulations. We propose that meeting such goals requires treating fitness function identification as a secondary optimization step. An adaptive algorithm that can vary the selection of fitness functions could adjust its selection throughout the generation process to maximize goal attainment, based on the current population of test suites. To test this hypothesis, we have implemented two reinforcement learning algorithms in the EvoSuite unit test generation framework, and used these algorithms to dynamically set the fitness functions used during generation for the three goals identified above. We have evaluated our framework, EvoSuiteFIT, on a set of real Java case examples. EvoSuiteFIT techniques attain significant improvements for two of the three goals, and show small improvements on the third when the number of generations of evolution is fixed. Additionally, for all goals, EvoSuiteFIT detects faults missed by the other techniques. The ability to adjust fitness functions allows EvoSuiteFIT to make strategic choices that efficiently produce more effective test suites, and examining its choices offers insight into how to attain our testing goals. We find that AFFS is a powerful technique to apply when an effective fitness function does not already exist for generating tests to achieve a testing goal. 中文翻译: 基于搜索的测试生成以一个或多个适应度函数(判断解决方案最优性的评分函数)的反馈为指导。选择信息丰富的健身功能对于实现测试人员的目标至关重要。不幸的是,许多目标(例如,迫使被测类抛出异常,增加测试套件的多样性以及获得强大的突变覆盖率)没有有效的适应度函数公式。我们提出要达到这些目标,就需要将适应度函数识别作为次要优化步骤。可以更改适应度函数选择的自适应算法可以根据当前的测试套件数量,在整个生成过程中调整其选择,以最大程度地实现目标。为了检验这个假设,我们在EvoSuite单元测试生成框架中实现了两种强化学习算法,并使用这些算法为上述三个目标动态设置了生成过程中使用的适应度函数。我们已经根据一组真实的Java案例评估了我们的框架EvoSuiteFIT。EvoSuiteFIT技术在三个目标中的两个方面取得了显着改进,而在进化的代数固定的情况下,第三个目标显示出较小的改进。此外,对于所有目标,EvoSuiteFIT可以检测其他技术遗漏的故障。调整适应度功能的能力使EvoSuiteFIT可以做出战略选择,从而有效地产生更有效的测试套件,而检查其选择可以洞悉如何实现我们的测试目标。