Information Technology Reference
In-Depth Information
the output of that class to the whole application. So the need to change the code
in a lot of places is eliminated.
So object-oriented programming has a made a huge impact in improving pro-
ductivity of software developers in recent years.
Test cases contain many steps that are identical or similar to steps in other test
cases. A limitation of the record-and-play type of automation is that these similar
steps are recorded again and again during recording time. Thus, for the same steps
across many test cases, separate scripts are generated even though they are the same
pieces of code. Now if the application that is being tested gets changed, then you
will have to make changes at all of these places.
Now suppose you devise a method so that the generated scripts do not repeat
for the same pieces of code. Instead a placeholder for these pieces of code is
placed and the code in fact is kept at just one place. The code gets called at these
placeholders and gets executed. In such a scenario, maintaining the code base
of the automation script will become very easy. Whenever any changes occur in
the application under test, you just have to change the code base once at places
where you are keeping the code. Now when that piece of code is called at place-
holder places, this changed code gets executed. Thus maintenance effort will be
significantly reduced and managing the automation script base will become a lot
easier.
To achieve this goal, some approaches have been devised. The best one is known
as the keyword-driven automation framework.
9.4.1 Steps for Creating Keyword Framework
There will not be any changes in the way test cases are written for manual execu-
tion for creating the keyword framework. So design and write your test cases. Find
out which test cases have steps that are the same for other test cases. Make an
inventory of these steps. Once these are ready, use your automation tool to record
these steps. Input appropriate names for each of these scripts. These will be the
functions that can be called inside the main script. After that, go back to your test
cases and record for the entire test case suite. Now delete generated scripts for the
steps for which you had done a separate recording. Now put a placeholder in place
of deleted code (function calls). Call the appropriate function at these places. Now
you are done.
The keyword framework is similar to procedural programming. So test automation
has not reached the stage that object-oriented programming has reached. Still, using
keyword framework, you are promoting code reuse and increasing productivity.
The approach described above is fast. Some other approaches are also available.
Depending on the tool capability, amount of time in hand, and skills of the auto-
mation engineers, this process can be either refined further or made more granular
to save time.
Search WWH ::




Custom Search