In order to test the code, I felt it would be best to test individual segments of the model in order to check that each part does its job. This, in my opinion, is better than testing the complete system, as if something goes wrong it can be hard to detect exactly what and where the issue is. Commenting out segments of my code allowed me to test individual functions and algorithms, and I substituted random variables with test case inputs in places I needed to test specific outcomes of a function.
For example, I had a problem with the Ace function where it was not giving the correct values. Rather than hope the player was randomly assigned an Ace, I replaced the random variable so that I would consistently be dealt Aces. This allowed me to see the specific issues with the system. I found that it was not correctly deducting the value of the Ace if the player went over 21, causing the player to go bust when they had a hand that shouldn’t be over 21. By testing this repeatedly I was able to find the specific line of code that was causing the problem and alter it.
By using test case tables I was able to document my tests and visualise the problems I’ve come across and how I was able to solve them. Below are examples of test case tables I made before fixing my code and after. You can see that after fixing the function the actual outcomes were in line with the expected outcomes.