Forum Discussion

micheleaz's avatar
micheleaz
Senior Member
7 years ago
Solved

Keyword vs Scripting in Test Complete 12

Hi all: I searched in the forums and this discussion occurred years ago but I feel that things may have changed in the latest version. My question is this: Scripts vs keyword tests-- which is bette...
  • tristaanogre's avatar
    tristaanogre
    7 years ago

    Keyword testing does very well for creating tests where the folks doing the creation don't have a lot of actual coding experience or expertise.  You can easily create robust and well formed tests using keyword tests.  However, I've found that for some of the more complicated tasks (like the one I'm working on right now where I need to run a stored procedure on a SQL server and check the result on screen in the application), Scripting works better.  I'm sure I could figure out a way to build the ADODB objects, assign properties, etc., in a Keyword test but I've found that kind of work to be cumbersome where writing JavaScript or Python code would be more efficient and compact.

     

    As for writing a script from scratch and getting visualizer... the same is for writing a keyword test from scratch without recording.  No visualizer is created necessarily at the time of writing it.  However, you can tell TestComplete to capture the visualizer images at playback to add them to your test case after the fact.

     

    As for "more bang for your buck"... everything you can do in Keyword tests can be done in Script code... checkpoints, screenshots, loops, code logic... it's all, basically, the same.  The only difference is Keyword tests have the particular set of operations that need to be used to build the test where Scripting you can do a lot more in the way of creating custom code, routines, etc., and leverage all the features of your chosen scripting language.  For example, you can't create custom JavaScript objects and classes in keyword tests.  I use these for building my SQL queries, for running my framework, etc.  Not possible with keyword tests but certainly possible with script code.

     

    As Manfred_F said, use Keyword testing if it works for you.  If you don't need anything more, then by all means, use it.  But I've found that a good, well thought out blend of the two works pretty well, too.  Code libraries of script routines that can be used within the keyword tests, Script Extensions to build my own runtime objects... I've even started looking into building my own plugin using the SDK (although, this will be a new exploration for me).  I honestly, don't think Keyword testing replaces Scripting at all... but it certainly is good for building tests quickly that can then be supplemented by the aforementioned tools.