Forum Discussion

Vaccanoll's avatar
Vaccanoll
New Contributor
8 years ago

Classes in Javascript

I can't tell what version of Javascript is currently supported by TestComplete, but I am really hoping it supports classes of somekind.  (Bascially EcmaScript 2015)    I tried searching for it, but...
  • tristaanogre's avatar
    8 years ago

    From the help at https://support.smartbear.com/testcomplete/docs/general-info/version-history/features-added-to-ver-12-0.html

     

    TestComplete 12 adds JavaScript (ECMAScript 6) as a new scripting language for writing automated tests. You can record, write, run, and debug tests written in JavaScript.

    JavaScript in TestComplete is powered by the V8 engine – the same engine that is used in Google Chrome and Node.js. For the usage specifics, see JavaScript - Specifics of Usage.

     

    As an example.... see, this past Friday was Hobbit Day (yes, I'm that much of a nerd) and I have this bit of PseudoCode hanging on my wall of my cubicle:

    import gandalf;
    import balrog;
    import bridge_of_khazad-dum;
    public class GandalfvsBalrog extends Moria
    {
    Wizard Gandalf; //declare variables
    Balrog misterSparkles;
    main()
    {
    Gandalf.print("You Shall NOT PASS!!!);
    misterSparkles.print("RARARARRRRARR!!!!);
    Gandalf.HitGroundWithStaff_MakeBridgeFall;
    if(misterSparkles.isFallingWayDown)
    {
    misterSparkles.whipGandalf_bringHisButtDownToo;
    }
    while(Gandalf.isFallingWayDown)
    {
    Gandalf.GrabSword_KickButtandYellAlot;
    }
    return One_Smoted_Balrog;
    }
    }

    So.... For Hobbit Day, I converted this into a JavaScript automation.  I've attached the code units as an example... the result looks like: