Agile testing

How to Cook Spaghetti: Test Case Design for Beginners

First steps in Methodology…

Do you remember the very famous Italian inventor Innocenzo Manzetti (1826 – 1877) who came up with the “noodle machine” in the year 1857? Nobody knows, but he also drafted secretly the first “fully-automatic-spaghetti-cooking-machine” one year before his death. He never got the opportunity to bring the topic up to the family table since his mother was very traditional in preparing the daily dinner. So the invention was nearly forgotten until his great-great-grandson Mario Manzetti, who was just 8-years-old and like his grand-grand-grandfather very brainy, found the old scripts of the idea in the attic.

Unfortunately, Mario was yet not very inventive and computer-skilled, so he asked several people to help him with advancing the idea. After a couple of days, he had a complete project management team consisting of a process engineer, software-developer and software-tester. The process engineer, Mario´s mother, was really delighted that Mario was suddenly interested in the spaghetti cooking process although he did not tell her about his real purpose. She gladly helped him draft a first “activity- and control-diagram”, which was basically copying a recipe from an old cookbook. Fortunately, his older brother, studying software development at the local university, assisted him in specifying the software-logic for the “fully-automatic-spaghetti-cooking-machine” which looked like the following:

Mario’s brother had told him that software testing was crucial for the business success of his “fully-automatic-spaghetti-cooking-machine”. In search of a Software-Testing-Tool, Mario found the “14 day Tricentis Tosca Testsuite Trial” on the Tricentis website and designed a very easy Test Case Design for his “Spaghetti-Cooking-Application”.

According to his control-diagram he defined three process attributes, always using two instances: “yes” and “no”. Yes meant the cooking process would run through, while No meant that the cooking process would stop during the test. Furthermore, Mario thought of different scenarios – also called test cases – that could occur and designed the following tests for his software:

  1. If the water is boiling, and if the spaghetti is added, and if the spaghetti is cooked for 10 minutes, then the spaghetti would be al dente. By this he created a straight through, which is the most likely usage scenario for his machine, and marked it in red.
  2. If the water is not boiling but the spaghetti is added, then, without thinking twice, the dinner wouldn’t hit the spot.
  3. If the water is boiling and if the spaghetti is not added to the water, then there also would be no dinner.
  4. If the water is boiling, and if the spaghetti is added, and if the spaghetti is not cooked for exactly 10 minutes, his machine should display an error.

That´s why he marked the test case 2-4 as invalid.

In doing so Mario designed a program logic based Test Case Design for the basic functionality of his “fully-automatic-spaghetti-cooking-machine”. In Tosca it looked like this:

Although the “fully-automatic-spaghetti-cooking-machine” was yet not constructed, he was impatient to prove his test cases. That evening he studied his mother working in the kitchen and preparing the dinner in order to verify his first test. His mother boiled the water, added the spaghetti and cooked it for 10 minutes. As usual, the family had a nice dinner.

The next day Mario told his mother that he would like to cook the spaghetti for that night’s family dinner. He had in mind to reproduce the different test scenarios in order to check if the expected errors would occur. His mother, not knowing Mario´s intention, said yes and took the chance to go to the hairdresser.

When she came back she found that no spaghetti was cooked at all. She shouted, but Mario explained that he forgot to boil the water. He promised he would do better tomorrow.

As Mario´s mother is a good mother, she was willing to let him try again tomorrow. The next evening before leaving for a manicure she watched Mario boil the water. But again, after coming back, she found that there were still no spaghetti on the table since Mario did not add the spaghetti to the boiling water. She shouted again and Mario desperately begged to try tomorrow again. Mario´s mother sensed his desperation and allowed him to do so.

The next day Mario´s mother watched accurately that her son boiled the water and added in the spaghetti before she left for her pedicure. Mario was still standing in front of the electric cooker when she came back. The spaghetti had already cooked for 30 minutes.

Mario remembered a lot of noise and his mother saying things like: “Error, Error, Error!!!” and “You will never cook for the family again…” and “Mamma Mia, it´s only cooking spaghetti, the simplest meal on earth…”.

Maybe that´s the reason why he finally put all his effort aside although he has proved his test cases right for the “fully-automatic-spaghetti-cooking-machine”. All four different scenarios had been executed according to the process parameter the expected verification. He thought: “Would mankind have the need for a simple “spaghetti-cooking machine”?” Perhaps not. In any case, Mario was already thinking about preparing a Test Case Design for his next software driven invention, the “fully-automatic-five-course-Christmas-dinner-for-12-friends-machine”.

Interested in learning more? Read about Risk Optimization through Test Case Design here.