Forum Discussion

SmartBST's avatar
SmartBST
Contributor
7 years ago

TestComplete Best practices for Keyword testing

 

Hi,

 

Being new with TC Keyword testing  technologies,

I’m trying to clarify the best practice to test web applications with Keyword testing 

 


Not sure if this is the best way to go(!), to clarify to the whole team.

 

 

Thanks in advance

  • I think there are some best practices that follow whether or not you're using Keyword Testing or Script code.  Because, basically, Keyword Testing IS code, just done visually rather than typing it out.

     

    1) NameMapping... Get it right the first time.  No. Seriously. Spend the extra time to properly map components.  When you record a test, auto-mapping happens... don't keep it.  Go back and rework your NameMapping manually so as to do the BEST work in object identification. What some people do is actually do the NameMapping manually FIRST before you record so that the recording uses the mapped objects you already selected.

    2) Don't keep the recording.  Recording test cases is a good start... but it rarely is what you ACTUALLY want to keep.  There are timing corrections that need to be made, validation checks, "If object exists" checks, etc., that you will want to add in to your test case to make sure that it runs as cleanly and as reliably as possible.  Sometimes you may need to do some "fancy" stuff to actually get the test to work

    3) Learn code. While Keyword Testing can do a LOT, there are some things that are just more efficiently done using script code routines.  For example, there are no such things as case or switch statements in keyword testing.  To do the same, you would need to write multiple if-then logics, extending your keyword test and slowing down processing. Even if you don't write a lot of code, you will still need the skills.  Keyword tests can use "code expressions" as parameters for operations.  You can execute code snippets in keyword tests.  And, for that matter, code rules still apply.  If you want to understand things like if-then logic, for loops, while loops, exception handling... ALL things that are available in Keyword Tests... it would be good for you to understand how those things work in code so you can utilize them in Keyword tests.  Plenty of online tutorials for that

     

    These are my top 3... there may be others but honestly, this is where I would start.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    I think there are some best practices that follow whether or not you're using Keyword Testing or Script code.  Because, basically, Keyword Testing IS code, just done visually rather than typing it out.

     

    1) NameMapping... Get it right the first time.  No. Seriously. Spend the extra time to properly map components.  When you record a test, auto-mapping happens... don't keep it.  Go back and rework your NameMapping manually so as to do the BEST work in object identification. What some people do is actually do the NameMapping manually FIRST before you record so that the recording uses the mapped objects you already selected.

    2) Don't keep the recording.  Recording test cases is a good start... but it rarely is what you ACTUALLY want to keep.  There are timing corrections that need to be made, validation checks, "If object exists" checks, etc., that you will want to add in to your test case to make sure that it runs as cleanly and as reliably as possible.  Sometimes you may need to do some "fancy" stuff to actually get the test to work

    3) Learn code. While Keyword Testing can do a LOT, there are some things that are just more efficiently done using script code routines.  For example, there are no such things as case or switch statements in keyword testing.  To do the same, you would need to write multiple if-then logics, extending your keyword test and slowing down processing. Even if you don't write a lot of code, you will still need the skills.  Keyword tests can use "code expressions" as parameters for operations.  You can execute code snippets in keyword tests.  And, for that matter, code rules still apply.  If you want to understand things like if-then logic, for loops, while loops, exception handling... ALL things that are available in Keyword Tests... it would be good for you to understand how those things work in code so you can utilize them in Keyword tests.  Plenty of online tutorials for that

     

    These are my top 3... there may be others but honestly, this is where I would start.

    • jheinitz's avatar
      jheinitz
      Senior Member

      Thank you for the post Robert.

      Question for newer Automation engineers...new to development/programming.  What language would you recommend to learn and do you have any suggestions like YouTube, etc that maybe have some good training for newbie's to programming?

       

      Thank you!

      Jason Heinitz

      • shankar_r's avatar
        shankar_r
        Community Hero

        SmartBear itself having 101,102 and 103 training sessions. you can participate in that. Meanwhile you can watch existing training videos here