0

My program is a game called 'Hangman' finding a word, which added to the program and choosing a word randomly how can i make this possible to write a test case

so far you got:  h___
Enter your next letter: a
so far you got:  ha__
Enter your next letter: r
so far you got:  har_
Enter your next letter: l
Wrong Try Left:  4
so far you got:  har_
Enter your next letter: e
Wrong Try Left:  3
so far you got:  har_
Enter your next letter: o
Wrong Try Left:  2
so far you got:  har_
Enter your next letter: d
so far you got:  hard
YAY!!! You Win

I want to add a test case for whole program at once

  • Tests are about reproducibility. One thing you can do is fixing the [`seed`](https://docs.python.org/3/library/random.html#random.seed) when testing, so the program will pick the same series of words. Then you can work out input sequences for testing success, failure, and handling of invalid inputs. – tevemadar Feb 14 '23 at 15:21
  • Does this answer your question? [How to validate a unit test with random values](https://stackoverflow.com/questions/26091330/how-to-validate-a-unit-test-with-random-values) – tevemadar Feb 14 '23 at 15:23
  • Thank you very much I'll try with this method – Hiran Sanjeewa Feb 17 '23 at 06:01

0 Answers0