Forum Discussion

KSQian's avatar
KSQian
Contributor
8 years ago

TestComplete doesnt like promises?

Not a big deal. We have this method that reads a large excel file so I thought maybe I can do some concurrency to fire off other operations in the meantime.

 

We use testcomplete overnight so I'm not gonna sweat the extra 10s to read the file or whatever. 

 

But just thought you guys should know that promises will straight up crash TC12.4 (x64)

 

For example run this simple test code. 

function basicPromise() {
  const my_promise = (pass)=> {
    return new Promise((resolve,reject)=> {
      if (pass) resolve("pass")
      reject("fail")
    })
  }
  const test = my_promise(1)
}

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Not sure about promises... but you're using arrow functions... based upon the help, they are not supported.

     

    https://support.smartbear.com/testcomplete/docs/scripting/specifics/javascript.html

     

    Unsupported Features

    • JavaScript in TestComplete does not support the ECMAScript Internationalization API.

    • JavaScript in TestComplete does not support arrow functions. For example, the following code will cause a syntax error:

       
      // Arrow functions are not supported 

      var f = x => x > 0; // Syntax error!
       
      I'm not familiar with what promises are... but automated scripting in TestComplete is single-threaded... everything is run synchronously... so it actually makes sense that Promises are going to cause TestComplete to have a hissy fit.
       
    • KSQian's avatar
      KSQian
      Contributor

      They're supported now in 12.4!

       

       

       

      const cheers = text=>Log.Message(text) 

      cheers("weeeeee!")

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Hrm... than the help is outdated and needs an update...

         

        In any case, the asynchronous nature of promises is probably where things go wonky...