Constructing functional test cases using incrementally de~ned state machines