Desktop User Guides > Professional > Interview scripting > Sample management > Sample management facilities > Debugging and testing scripts
Debugging and testing scripts
Before you use a sample management script in a live survey, you must test it rigorously to ensure that it performs as you expect in all situations.
The activation process displays an error message if there is a syntax error in the script. However, it cannot detect other errors, such as errors in the logic.
Try to think of every possible situation, and then run trial interviews to test that the script works correctly in each situation. These are some suggestions:
Check that authentication finds the correct sample record when the authentication fields are entered correctly and, where relevant, that the authentication fails when they are entered incorrectly. For example, if there are two authentication fields, check what happens when the respondent enters both correctly, both incorrectly, and one correctly and one incorrectly.
Check that the script creates sample records correctly for new respondents, when relevant.
Check that the script is handling the serial number correctly by restarting some interviews and checking whether the correct case data record is retrieved.
Check that the sample records are moved to the appropriate queue at the end of the interview.
Check that all of the fields in the sample table are updated correctly.
If the script is routing respondents to different interviews, set up test interviews to test every routing possibility.
If you are using custom web pages (for example, to display different authentication-failed pages in different situations), set up test interviews to test every possibility.
If the script includes quota control, check that quotas are being pended, completed, and rolled back correctly, and that respondents who fail quota control are rejected from authentication and see the interview-rejected page.
When you are debugging scripts, you might find it helpful to use the logging feature to instruct the script to log each event. This enables you to trace the actions the script takes during the interview.
If you are writing or using sample management scripts written in the UNICOM Intelligence scripting language, you can use the debugging framework script to test a script: see Debugging scripts for more information.
See also
Debugging scripts
Sample management facilities