Test editor tips

From ITR Wiki

Tips & tricks and test examples are always welcome! If you have a good test example you want to share or some good tips or tricks let us know and we will put them here.


Making a screen in a test show based on a condition

There are many reasons why you should want to skip a screen in a test. For example when the candidate keeps answering items of a certain level correctly, or when in another test in the same session some screen has already been shown.

In the example below a certain set of research questions is asked for each tests. A research question can for example be :

  • what is your gender
  • what is your age
  • where do you live

If you have multiple tests in the same session for the same candidate then asking these questions in each test is annoying for the candidate.

In the test editor you can set a pre script on a screen. To be able to do this first select the option Test has screen dynamics on the test information tab. Then go to the tab Contents and select the question which you would like to show or hide based on some criteria. In the bottom of the editor open the section Screen dynamics and edit the screen pre script.

The following code hides the research questions screen if the gender was selected in another test in the session. Please note the the option Store at session level must be switched on for these questions.

let x = -1; 
if (typeof session.PluginData.sessionStorage != "undefined" && typeof session.PluginData.sessionStorage.ResearchGender != "undefined") {
 x = session.PluginData.sessionStorage.ResearchGender;
}
if (x > -1) { screen.show = false; }

It is off course also possible to hide certain components in a screen, or take some other action like ending the test, jumping to a specific screen or show a message. The possibilities are endless.

The same goes for the screen post script. If a certain answer has been given then you can skip the next question, or do something else in your test.