Evaluating as a JS-expression

Include calculations and JS-features in your scenarios 🧠

There is an opportunity to turn on evaluating your expression as a JavaScript code (ECMAScript 5.1):

Turning ON/OFF the option in a filter

Remember, that if you turn on this option and make a mistake in the syntax, the scenario will stall with an exception message.

Checking the expression

You can check the result of evaluating you expression by clicking Check the expression link. Here you have to provide an ID of the object:

Checking the expression providing an object with ID=1

Don't mix "Check the expression" feature with step testing.

Examples of evaluating as a JS expression


🅾️ JS-interpreter is off

✅ JS-interpreter in on

{{a}} +1

// {{a}} = 3

3 + 1





// some random value 0.0–1.0

Today +1 day

and similar expressions

Today +1 day


// today at 00:00


// {{a}} = 'hello world'

'hello world'.length



// {{a}} = '1,-12,hello' (array type)



// Note! It evaluates as a string.

Learn how to deal with arrays

Don't forget to quote the 'fields' in order to compose JS-expressions with them.

Learn all the details and explore the examples of applying JS in Directual: