Ask a Question

Javascript String Interpolation

Occasional Contributor

Javascript String Interpolation

Is Javascript string interpolation allowed/recognized in TestComplete (14.70 fully patched)?

The reason I ask is when I'm logging some values I much prefer interpolation to concatenation.

i.e. I would like to use:

Log.Message(`Found match, group ${i}: ${m[i]}`);

instead of:

Log.Message("Found match, group " + i + ":" + m[i]);

both are valid JS and work on online prototypers, however the former (interpolation) results in Syntax Errors on the ` (backtick).

Does anyone know if this is a limitation in TestComplete or whether there's a syntax difference I need to be aware of, I couldn't find any documentation for this!

Community Hero

This works wery well for me:


function testInterpolation() {
  var i = "i_value";
  var arr = ["value1", "value2"];
  Log.Message(`This string contains that two variables: first one -> ${i} and second one -> ${arr[1]}`);


I'm using the latest version of TestComplete.

Occasional Contributor

Thanks, @Wamboo, so I just pasted this straight into my test script, and straight away it has the red x with a syntax error:



Occasional Contributor

Wait a minute...

I did some digging, and it would seem this project is in fact JScript and not JavaScript (which also explains another issue I nearly put on here).

I have just run the Javascript conversion (a great feature) and I can now write as I expect. at least I've only wasted 2 hours 🙃

I was just wondering if you have a project in Jscript 🙂 It's great that you managed to fix it.

Showing results for 
Search instead for 
Did you mean: