Creating automation scripts using a generic framework is useful. The framework should have recovery scenarios and it should also perform a quick check after test execution using customized logs. The test execution summary must provide accurate information on test case execution. This article on IBM® Rational® Functional Tester elaborates this process.
1. Abstract: Creating automation scripts using a generic framework is useful. The
framework should have recovery scenarios and it should also perform a quick check after
test execution using customized logs. The test execution summary must provide accurate
information on test case execution. This article on IBM® Rational® Functional Tester
elaborates this process.
1) Reusability and recovery scenarios:
There are many buzzwords in automation frameworks like keyword driven, data driven
etc the framework which I am sharing I have not given specific name to this framework
but as it used different combination hence we can say it as modular framework.
In this framework we are using find method which we have generalized so that we can
use in any of the test case whenever it’s required. Also best part of the framework is we
are calling test scripts in a sequence using windows batch file.
In-between the execution of test scripts if a scripts threw exception/fails then with the
help of custom logging we can find out which scripts has exception during the execution.
In our scripts we can follow below mentioned way of writing java code.
Main function
{
Try
{
If (Test case met expectation)
{
PASS
}
Else
{
FAIL;
Mentions fail test case Id using logInfo and in Customized logs(Placed in
secondary memory in our machine).
}
}
Catch(Exception e)
{
Handling Exception’s;
If in case of any exception write test case ID to Customized logs mentioned
exception in script. Writing Test Case ID in customized file helps us in analysis
post test execution.
}
Finally
{
Writing code which you want to do at the last of script.
We are usually releasing memory at the end of every method and closing
application browser.
}
1
2. }
2) Batch file, customized and consolidated logs
Batch File-We are using it for test execution by calling all script in a sequence.
What is a Batch file?
This hybrid framework is used to develop the test scripts and are executed in batches. Framework
has been designed in a way that does not required to open RFT in-order to execute the
Automation scripts. This helps system to save memory space and in long test run (larger scripts or
bigger batch of scripts) and helps to mitigate the chances of impact on available memory. We are
using windows batch file for execution of our scripts, we don’t need to open IBM RFT for
execution of test suit. By doing this we save automation machine memory as in long test run
where hundred of scripts are in queue during execution can impact test run due to lack of
available memory.
How to write Batch file-
Set RFT_PROJECT_LOCATION="C:Documents and SettingsMy DocumentsTest
Cases”
"%IBM_RATIONAL_RFT_ECLIPSE_DIR%jdkjrebinjava" -classpath "%
IBM_RATIONAL_RFT_INSTALL_DIR%rational_ft.jar"
com.rational.test.ft.rational_ft -datastore %RFT_PROJECT_LOCATION% -
playback TestCase1 -log TestCase1
We can call multiple test scripts using above batch file, using batch file for multiple script
execution also saved us from using IBM RFT User Interface for the same consequently
this saves a lot of memory during script execution.
In this framework to prepare and get a suitable environment ready for executing test cases
using IBM RFT too Below mentioned steps can be followed in order to perform
Automation testing and Analysis.
1) Configuration/Pre-Requisite.
For any testing performed via Automation tool few inputs are required before test run, and are
called Configurations / Pre-requisites. Configuration part needs to be performed by the
Automation engineer, as technical skill set is required to configure the tool and environment.
2) Execution of Scripts, Using Batch file.
3) Post Execution analysis of customized logs and consolidated logs.
What are customized logs?
We are writing errors/exceptions in customized logs that means when a test case is not as per
expectation we log them in customized logs also in case of script exception customized logs are
2
3. created for that specific test case therefore in case of exception we have to manually execute that
scripts and Automation engineer will look in to the failed script.
What are consolidated logs?
At the end of script execution IBM RFT saves execution summary in logs which in our
framework we are calling them as consolidated logs as it contains customized logs as well as
other execution summary also which included pass/fail verification points etc.
Find below image of custom logs file where we are writing fail and exception during test
scripts using java code. Using custom logging approach we can quickly find which all
test cases are failed and which threw exceptions during the batch run.
Figure1-Screen capture of customized logs .
Alt =Capture of Customized log file
Analysis
Once we have execution completed we have to analyze test execution therefore our first
job is to view customized file.
How to analyze logs?
We have to first verify customized logs which is saved in secondary memory (specified location
during logging the same during test execution) of our machine In case of any Exception found in
that logs then we have to validate the same in consolidated logs.
4) Post logs analysis functional test engineer will raise defects if found any.
Once we have analysis completed Functional test engineer will raise defects found if any in
regression project tracker mentioning an additional note that defect found during automation run.
3
4. 3) Framework Highlights- To segregate the framework, below given figure can make user
understand the complete flow easily.
Figure 2- Data flow diagram of framework
Alt =Data flow diagram of framework
Framework highlights-
• Application framework is based on 2 layered architecture, where layer consist of test
Scripts and Layer 2 consist of reusable functions.
• Run Time Object Identification using Find method.
• Using Batch file to execute multiple test scripts in one go without opening RFT tool which
saves computer memory during execution of huge number of test scripts.
• Created Custom logging for finding failed test cases out of all executed scenarios which
is helping us in quick analysis of execution.
• Using verification point and customized logging in scripts.
• Created scripts using java for robustness as recorded scripts sometimes did not work or
throw exceptions.
• We are dynamically generating all required test data(input) for application functional
testing using java API’s and java code.
4) Summary:
The primary objective of an automation effort is to design a robust framework using
generic scripts that can execute across different platforms and requires minimum
4
5. maintenance. This artical provides insights into an approach that uses find method of test
case creation with custom logging to achieve it.
References:
• http://www.redbooks.ibm.com/abstracts/sg247391.html.
• Find everything developerWorks at the developerWorks main page.
• Find out more on the Rational Performance Tester product overview
page. Then explore the Rational Performance Tester page on IBM®
developerWorks® for links to technical articles and browse the user
assistance in the Rational Performance Tester Information Center.
• Visit the Rational software area on developerWorks for technical
resources and best practices for Rational Software Delivery Platform
products.
Author- Prashant
Email-Prashant.compsc@gmail.com
5
6. maintenance. This artical provides insights into an approach that uses find method of test
case creation with custom logging to achieve it.
References:
• http://www.redbooks.ibm.com/abstracts/sg247391.html.
• Find everything developerWorks at the developerWorks main page.
• Find out more on the Rational Performance Tester product overview
page. Then explore the Rational Performance Tester page on IBM®
developerWorks® for links to technical articles and browse the user
assistance in the Rational Performance Tester Information Center.
• Visit the Rational software area on developerWorks for technical
resources and best practices for Rational Software Delivery Platform
products.
Author- Prashant
Email-Prashant.compsc@gmail.com
5