采用基于马尔科夫链使用模型的软件测试,在状态与激励序列中,从“开始”状态到“结束”状态形成一个完整的测试案例。因此,输入和激励的选择对于产生高效的测试案例十分重要.提出一种激励选择——带概率约束的随机选择方法,以软件Markov链模型的状态迁移概率作为激励选择的约束条件,使用遗传算法中用于选择下一代种群的选择算子——轮盘赌选择算子对激励进行选择。通过与以往的激励选择方法对比,验证了所提出的方法能提高生成测试周例的有效性。
In software testing based on Markov chain usage model, the sequence of state and stimulus from state"Start"to state"Exit" is a complete test case. Therefore, test input, stimulus, is very important to generate effective test case. Focusing on this, a method for selecting stimulus is proposed in the paper, called a random selection algorithm with probability constrained. This method uses the migrating probability between states of Markov chain usage model as constraints, selects stimulus by roulette selection operator, and then gets the next state. Roulette selection operator is used in genetic algorithm to select next generation of species. In this paper, it is used to select stimulus at every state. Compared with the previous selection method, random selection algorithm with probability constrained can improve the effectiveness of test cases.