Adding a test
From DevRiot for .Net and Java
Let's assume that agile methodology is in place. As soon as the class skeleton is created tests should be added.
1) Locate the cursor in the context area of the method you wish to use, then click on the add test button. In the image below, we customized Visual Studio to include some buttons in the editor's context menu in order to save moving around the IDE needlessly.
After clicking on "Riot: Add Test" the following form will appear:
This forms contains the following controls whose main task is to interact with the user:
- "ID" field in the upper left corner. This field will take integer values that will enforce the execution order and identify the tests.
- A signature text field in the upper right corner that displays the different elements of the current method under test (M.U.T).
- A label below the "ID" field that indicates if the M.U.T is a constructor or not.
- A button in the lower right corner that adds (when pressed) the test to storage and to the main execution queue if the minimum check passes. The minimum check for tests to successfully queue is that all the input parameters have valid values for their type.
- A series of tabs and nested tabs containing trees that graphically represent the values/states to be compiled in the test. Some of the tabs are for inputs, like the "Pre-State" or input parameters, while other tabs are for expected outputs, like "Return Value(s)", "Post-State", or out parameters. In the case of ref parameters that can be input and expected output, two tabs will appear one for the input (required) and the other for the expected output (optional).
The different types involved in a test ("this", parameter, and return types) are represented in TreeView widgets contained in the tabs mentioned before. These TreeView widgets will expand and contract according to how deep inside a type users need to go.
In the first screenshot, we are preparing to set the state of the type under test (T.U.T) prior to test execution hence the name of the tab "Pre-State". This is an input tab. Conversely, if we were interested in verifying the expected state of the T.U.T we would have followed the exact same steps but using the "Post State" tab.
In the second snapshot, we already decided which field we wanted set prior to execution, double-clicked its node and provided a suitable value and precompilation succeeded. The node was added to the build tree.
The third image shows the value we placed in the only input parameter tab this M.U.T owns. It is an integer value type so precompilation succeeded and RIOT engine behaved accordingly. After clicking the "Add" button the output pane of Visual Studio should show a message like the following:
"1/9/2010 8:42:22 PM: Test ID: 52501 added to the suite". That is all.
The fourth and fifth images simply show alternatives ways of setting up values in the trees.
NOTE: Visual Studio and TreeView are products and/or trademarks of Microsoft Corporation.