Ranorex provides the possibility to debug code directly in the development environment.
To enable the debugger click the Enable Debugging button in the toolbar.
To make the Debugger stop at a specific position in your code, you can set breakpoints.
Breakpoints can either be set
- Clicking the left margin at the line you want to set it
- Putting the cursor on the line you want to add a breakpoint, open the Debug menu, and choose Toggle Breakpoint.
By setting a breakpoint, a red circle is added at the margin, and the line of code is highlighted in red. The breakpoint can be removed in the same way as it has been added.
After setting a breakpoint the debugger can be started by executing your application as described in the chapter Run.
The application will start and Ranorex Studio will switch to the Debug Layout which causes the following menu items to be available from Debugger menu and toolbar:
Continue debugging | Continues execution |
Stop process | Forces the process to stop |
Step over | Executes the statement on the current line but it will not step into |
Step into | Executes the statement on the current line and stops at the first line of code inside the method |
Step out | Finishes executing the current method and returns to its parent method |
To skip several lines of code and continue debugging on a specific line, the context menu item Set Current Statement can be chosen by right-clicking on the line and choosing Set Current Statement from the context menu.
In paused mode, the actual state of the individual objects can be diagnosed.
The following windows can be activated in the sub-menu Debug which is part of the View menu.
Callstack | Shows method calls currently on the stack. |
Local variables | Shows variables defined in the function currently being executed, arguments passed into the current function, and fields and properties of the class where the function is defined. |
Watch | Shows all expressions added to the watch list. Expressions can be added by right-clicking on the window, choosing Add from the context menu, and entering the expression. Expressions can also be added by selecting them in code and dragging them into the ‘Watch’ window. |
Additionally, to the different views, it’s also possible to diagnose individual objects directly in code using the tool tips popping up when moving the mouse over them.
If Visual Studio 2010 is installed on the machine running Ranorex Studio, debugging might be slow. To overcome this issue it is recommended to search the key ‘LowLevelHooksTimeout’ in the registry and delete all occurrences.