Training Test Automation Scripts for Dynamic Combat: Self Defense

[article]
Part III

Input "JPass" into Password textbox

3

Click Login button

4

If "Login Error" dialog exists then

5

          Click Ok button

6

          Log Error

7

          Abort the test

8

End If

Figure 1: Localized example of exception handling.

This example has some exception handling in steps four through eight. This example specifically looks for the anticipated "Login Error" dialog, handles it by clicking the OK button, and then aborts the test. The advantages to handling this error are: time is not wasted by continuing to execute a failed test; the report will be clean because only the main error will be logged; and the following tests will not be adversely affected.

Another approach to handling this error is to use exceptions and a separate error handler, as seen in figure 2.

1

Input "John"
into Username textbox

2

Input "JPass"
into Password textbox

3

Click Login
button

4

scrVar = Verify
"Welcome Screen" exists

5

If scrVar Not
Equal to "Pass" then

6

          Pass
scrVar to Exception Handler

7

End If

Figure 2: Passing to error handler.

This example reveals how an exception handler may be introduced. An error code is received from a verification point (line four), then the error code is sent to an error handler in the event that the code is not a "Pass." The exception handler will be responsible for executing exception code similar to what is shown in figure 1, in addition to handling other types of errors that may occur.

Stay tuned for Part IV of the Taekwondo-mation series, in which I will explore the principle of Strikes (Dynamic-path handling).

Read Training Test Automation Scripts for Dynamic Combat: Flexibility  - Part I
Read Training Test Automation Scripts for Dynamic Combat: Balance  - Part II
Read Training Test Automation Scripts for Dynamic Combat: Strikes  - Part IV

About the author

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!