Effective Generation of Test Cases Using Genetic Algorithms and Optimization Theory