TestComplete Best practices for Keyword testing
- 7 years ago
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.