How to create your first function
Navigate to the Tomato website. This will open the graphical model view, specifically it will open and show an empty default function. In order to create a new function or rename the default function, move the cursor to the left side panel and click where it says ‘Functions’. This will expand the functions section and show all the functions that you currently have, you’ll notice that it currently only has the ‘default’ function for now.
Now in order to change that and rename the default function, you’ll simply have to click on the name listed in the functions list, in this case the name would be ‘default’. Once selected you can rename the function to anything you wish, in the case of this tutorial we’ll be renaming it to duel.
As you may have noticed there is a small red mark beside the function name, this is a global way in Tomato for signifying that there is an error, in our case the error is that the function does not have any parameters yet. So let’s fix that! In order to add our first parameter we’ll move away from the side panel and back into the main space of the model view. Here we can see a button labeled ‘Add Parameter’, by clicking it you’ll be prompted to add a name, let’s go ahead and enter ‘Protagonist’. This will instantiate an empty parameter, it will currently have a red mark since it does not have any choices. However, for now just leave it empty, we will add some choices once we’ve added all our parameters.
Now let’s repeat the process for three more parameters:
- Antagonist
- Weapon
- Location
If you wish you may use the built in suggestions in order to name these parameters. This is done very easily by simply waiting a few seconds before starting to write once adding a new function, parameter or choice.
Now that we have all our parameters, it’s time to populate them with choices. First let’s finish the ‘Protagonist’, to add a choice click the ADD CHOICE button and then give it a name. You can easily add another choice once you’ve made the first one by clicking the ‘enter’ button on your keyboard. Let’s add the choices for our Protagonist, ‘Peter’, ‘Edmund’ and ‘Susan’.
Afterwards, let’s make use of the suggestion functionality again and have the AI generate this last choice for us. This works in the exact same way as it was for parameters, add the choice and then simply wait for the suggestion.
As you can see, now that we’ve populated the parameter with choices, it is no longer marked with the red error mark. So now that we know how to add choices, let’s repeat this for out other parameters and ensure they all have the correct choices.
Here are the choices i’d like you to add for each of the parameters:
Antagonist:
- witch
- ogre
- cyclops
- goblin
Weapon:
- sword
- axe
- dagger
- bow
Location:
- forest
- castle
- swamp
Now that we have created all out parameters and populated them with choices, the model is officially ready for generating some test data!
To do this we simply click the button in the top right labeled GENERATE TESTS. This will open the generation window which allows the user to choose their preferred generator. All these generators are explained and gone through in another tutorial . But for now, we will be using the cartesian generator, which generates all valid combinations for the given model.
Once you’ve done this you’ve officially modeled and generated your very first model using Tomato. You’ll then be show the page that is in the figure below, which displays all the test cases that have been generated. These can then easily be downloaded as a CSV file by clicking the DOWNLOAD button. This CSV file can then easily be used in playwright tests or other test setups.

