Keep Your Code Clean and Robust

Your code should be fairly robust, meaning that it should account for the unexpected and always allow for orderly termination when errors do occur. Notice the Select Case statement in our example in the previous section. These three lines of simple code alert the tester that an unknown window code was read either because a new case statement has not yet been added to accommodate it or because a bad code found its way into the test data.

When using called procedures and functions, always construct it so that a return code is made available to the caller. This alerts the caller that either the function/procedure was successful, or failed, and allows for proper action to be taken.

Now that the window is selected, ...

Get Just Enough Software Test Automation now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.