Breadcrumbs

Testing with Interactive Debugger - Lesson 2

development_process_testing.png

Remember that the Interactive Debugger allows you to debug models at run-time. For detailed information on the Interactive Debugger see the The Interactive Debugger.

Checking the Services Properties

With the right mouse button click EducationLesson2 in the Deployment View of the Model Compiler and select Properties from the context menu:

model_compiler_select_properties.png
service_properties_general.png



Switch to the Global Settings Tab. The setting exchange rate CHF - USD you defined within the action script of Get Exchange Rate is displayed with its initial value.
The exchange rate may be changed here before starting the service:

service_properties_global_settings.png

Running the Service

Select Run "EducationLesson2" from the deployments context menu:

model_compiler_select_run.png

The Runtime window deploys the service to the internal server of the development environment and starts it in the Embedded Runtime. This is logged to the Run view. Remember that using the Embedded Runtime, the service will always be deployed to localhost.

run_view.png

The service is running now and can be tested with the Model Debugger.

Running a Test Case

Click Open Test Case in the Runtime window to switch to the E2E SOAP Test Tool in tab Test Cases..

open_test_case.png

The automatically created test case getProduct is displayed. It is marked with a gearwheel icon_test_case_gray.png . The gearwheel in gray color indicates that the test case has not yet been run. On the Request tab in the right panel, both input parameters inputTitle and inputProductRecord are displayed.

Behind each parameter name, the type and the assigned value are displayed. Initially, the parameters are set to null:

test_case_getproduct.png

The symbol icon_complex_type.png indicates a parameter of complex type, the symbol  icon_string.png a string. Create the parameter inputProductRecord, which is of complex type. Remember, that parameters of complex type have to be created by a create-statement. Click it with the right mouse button and select Create:

create_parameter_inputproductrecord.png

Expand the parameter inputProductRecord in order to open its attributes:

expand_parameter_inputproductrecord.png

Enter input values in the Request tab as shown below:

input_values.png

Run the test case:

run_test_case.png

If the test case reports no error, a green gearwheel  icon_test_case_green.png will be displayed in front of the test case name. The Model Debugger switches to the Response tab and shows the result:

test_case_response.png

Expand the output object outputProductRecord to inspect the response of the Web service:

expand_test_case_output.png

The output objects outputProductRecord and outputTitle have been returned after calling the operation getProduct of the xUML Service EducationLesson2.
The object outputTitle is a string and was reused from lesson 1.

All attributes of your input data are shown in the output object outputProductRecord. Note, that the value of the exchangeRate is also being displayed. It was set in the activity diagram Set Price CHF and Exchange Rate. The price in CHF was also calculated as defined in the action script.

Stepping through the Model with the Interactive Debugger

In this chapter, you are going to step through the lesson 2 model with the Interactive Debugger to recall the features of the debugging tool. Start the service in debug mode. If you do not stop the running service before, the runtime will stop the service and restart it in debug mode.

You can either select Debug "EducationLesson2" from the context menu of EducationLesson2 in the Deployment View of the Model Compiler, or ...

debug_lesson_2.png

... switch to the Debug tab in the Runtime window and click the Debug button:

runtime_window_debug_button.png

If the service is still running, you may also switch to the Run tab and click the Debug button there. The service will switch to debug mode without restarting:

run_tab_debug_button.png

The icon of the button changes and stays in activated mode. To turn off debug mode, just click this button again:

run_tab_debug_button_2.png

After starting the service in debug mode, the Runtime window switches to the Debug tab and shows the debugger waiting for commands:

debug_tab.png

Click the Pause button. The interactive debugger will pause the service at the next possible point: if the test case has not been started yet, this means the very first action of the service:

debug_tab_pause.png

Click Open Test Case to switch to the Test Cases tab. You can see the test case getProduct and its test case data:

open_test_case_debug_mode.png

Run the test case again:

run_test_case.png

The Runtime window switches back to the Debug tab (which is now highlighted in yellow) and the service has been paused on its first activity Get Title:

debug_tab_first_activity.png

Click Step into:

step_into_1.png

In the watches part in left panel of the debug window, you can see the input values. In the right panel, the debugger displays the action script statement highlighted that will be executed next: set outputTitle = inputTitle.toUpper();

Click Step Into:

step_into_2.png

In the watches panel note the additional object outputTitle that was created by the action script statement. It contains the value of inputTitle converted to upper case.
As the action script contained only one statement and there were no further statements to step into, the step into command resulted in switching to the next action node Map Product Record Data.

Click Step Over as it is not possible to step through the mapping statements.

Clicking Step Into in cases when it is not possible to step into or through an action script, the debugger automatically uses the corresponding possible command, e.g. Step Over or Go Up.

step_over_1.png

The watches panel displays the mapped data in outputProductRecord. In the activity diagram of activity Get Title the debug focus switched to the call operation action getExchangeRate.

Click Step Into:

step_into_3.png

The call operation action getExchangeRate was implemented in activity diagram Get Exchange Rate. As you stepped into the call operation action, the debugger switched to the corresponding activity diagram in the diagram pane.

In the script panel of the debug window, note the action script statement to be executed next. Click Step Into twice - first to step into the action node and second to execute the action script statement:

step_into_4.png

The debugger pauses on the activity final node and displays the result of the action script statement. Click Step Into or Go Up. The debugger will go up to the caller activity diagram and wait on the next action node:

go_up_1.png

Click Step Over:

step_over_2.png

The debugger pauses on the activity final of the activity diagram.

Resize the watches panel to have a better look at the displayed objects. Move the mouse cursor over the line separating the watches and the script part of the debug window. Drag the separator to the left until you can see all object values:

resize_watches_panel.png

Click Go To Next Breakpoint. As you set no breakpoints in the model, the service runs to its end.