A custom Groovy Script is a custom Java code to alter the runtime behavior of an exam. It is useful to achieve what out-of-the-box Groovy Scripts fail to achieve. We will see how a custom Groovy Script can be specified.
Steps to access the custom Groovy Script feature
- Select the DT Item Bank from the Home screen.
- Select the Develop Questions → Write Item menu, and click Write Question. Select any Question Type from the drop-down. The most common type is a Display-Type item.
- Click the Question Stem box for the Rich Text editor toolbar to appear and select the Tools → Source code menu. The HTML Source Editor pop-up opens.
- Inside HTML Source code editor, we need to specify the custom Groovy Script manually inside “[[Groovy:]]” placeholder as shown below.
- Click the OK button to insert the custom Groovy Script into the Rich Text editor.
- Save the item by clicking Submit, and then again Submit from the Confirm Submit pop-up window.
- Click the Home link and select a Standard Item Bank and select a Project.
- Select the Create Exam Form → View Exam menu to view the list of available exam forms.
- Select an exam form check box and click Build QTI Package button at the bottom. The Delivery Configuration Tool page opens.
- Right-click the ExamForm node and select Section from the pop-up menu.
- Select Section-Default from the drop-down list in the Add Template pop-up window and click Add. This adds a default Section node under the ExamForm node.
- Click the Section node created in the previous step and click the Add Item button below Section in the right pane. This launches a pop-up window to search for items from the DT Item Bank.
- Retrieve the item you had saved with the Custom Groovy in step 6, select it via corresponding check box, and click Add Contents button.
- The item is added to the Section. Click Save.
- Export QTI Package with the Export button.