A great way to test your survey while working on the script through the designer is by using the emulator debugger.
The Emulator Debugger will allow you to add breakpoints in different parts of your script in order to pinpoint the issue with the implemented code.
There are 2 main steps in when working with the Emulator Debugger:
- Adding break points in your script
- Working with the Emulator Debugger.
Step 1: Adding breakpoints in your script
- Breakpoints can be added to any part of your survey that has a script:
- Survey Init
- Advanced Script
- Expression Questions
- Question\Chapter Rules - Entrance Rules, Validation Rules, Jump Rules
- Question\Chapter Scripts - Start Script, End Script
- Chapter Loops - Iteration Break Rules, Iteration Start Script, Iteration End Script, Iteration Entrance Rule
- List Sources
- Attachment Sources
- Survey General Jump Rule
- Custom Actions
Please Note: A breakpoint is added across a survey and for all users - Which means that all users working on this survey will see these breakpoints and when they'll run it in the Emulator Debugger will stop at these points.
Step 2: Working with the Emulator Debugger
- There are 2 options to start the Emulator Debugger:
- Click on the Arrow next to the 'Run In Emulator' and then choose 'Debug In Emulator'
- Right Click on the Question in the survey you would like to start the debug from and choose 'Debug Question in Emulator'
- Survey Questions Display - Default UI screen that displays the questions (similar to the regular emulator)
- Log\Trace - The usual step by step log that will display the script logic and errors.
- Sources - The entire survey source code including the breakpoints added, organization scripts, advanced scripts and more. This is the screen that will help you debug your script and find any issues.
- Locals\Watch - In this screen you will be able to view the expected variables\Answers and Expressions results in the different parts of your code. Please Note: Here you can type functions\variables and see what was their results e.g: Answer(QRef(1)) will return the answer etc.
- Navigation Screen - Regular Question navigation pane where you can skip and return to different questions in your survey.
- Continue (F5) - Executes the next Line.
- Step Into (F11) - Executes code one statement at a time, tracing execution into function calls
- Step Over (F10) - Executes the next line of code but does not step into any function calls
- Step Out (Shift+F11) - Executes the remaining lines of a function in which the current execution point lies
- Show Current Line (F6) - Lets you return to the current line that you reached.
That's It !
Please sign in to leave a comment.