Upload
vongoc
View
221
Download
2
Embed Size (px)
Citation preview
Excel Macros: Automation for FREE!
Sindhuja Kumar & Senior Software Engineer
Capgemini Technologies India Ltd.
Abstract
An offer no Project Manager can neglect when accuracy, repeatability and speed can be delivered for almost... FREE! The testing industry is struggling to find innovative ways to optimize testing efforts and reduce costs. One of the best ways is usage of tools and accelerators. This typically involves investments in terms of infrastructure, licenses and expensive resources. A simple answer to most ever increasing automation need is Excel macros if one doesn’t want the maintenance hassle and costs involved Excel macros can be used to interact with applications, extract data from heterogeneous sources, generate reports which can be followed globally across testing landscape This white paper looks at applying Excel macros for automating critical, complex, repeatable process across the software testing life cycle and also attempts to explain why Testing industry needs Excel macro to attain accuracy, repeatability and speed at presumably no cost!
1. Introduction: Why you need to pay attention!
Problems with Manual process 1.1
In Software Testing life cycle, there are infinite manual efforts, for entering workflow
data, comparing data between files, retrieval of data, creation of test data, capturing
screenshots, pulling information from multiple locations into one file, generation of
reports, up- gradation of versions from multiple departments or cost centers and so on
Manual processes are slow and error prone. Carrying out the monotonous task
manually leads to error which reduces confidence in the outcomes
Few disadvantages of Manual processes:
1. Inconsistency in data entry, room for errors, mis-keying information
2. Training cost
3. People dependent
4. Time consuming
5. Duplication of data entry
Excel Macros: The way forward… 1.2
To a great extent variety of manual testing workflows can be automated. A terrific
innovative way is the usage of Excel Macros which is a programming language
embedded in Microsoft Excel that can be used for automating an Application under
test.
When speed is life, quality can’t be compromised and investment in
traditional test automation tools is a luxury
An Excel Macro is simply Visual Basic for Applications (VBA) code saved inside a
document. Macros are incredibly powerful and can do pretty much anything beyond
ones imaginations
Here are a ‘few’ examples of what Excel Macros can do:
1. Formatting
2. Manipulate data
3. Communicate with data sources (database, text files, etc.)
4. Create automated jobs and custom logic within macros
5. Save time on predictable, repetitive tasks as well as standardize document
formats
6. The most unique being ability to interact with applications and portals directly
and automate like any industry leading tool
Below are some of the key benefits:
1. Faster execution
2. Ease of maintenance
3. Reusability
4. Enhanced coverage
5. Extended reporting capability
2. Delving deeper in the Excel world
For most of the solutions based on Excel Macros there is absolutely no need of manual
intervention and a few data sheets can handle large tasks like a batch output validation of 100,000
records in a few minutes which state of the art reporting dashboards
“Excel macro provides the space to be intuitive and allows focus on more rigorous assessments”
Areas where macros can be used 2.1
To automate the procedure, processes where continuous improvements and wider coverage
of features are essential.
Testing is an integral part of any successful software
project. Decision for automation depends on various
factors, including project requirements, budget,
timeline, expertise, and suitability, ROI and
maintainability
Excel Macros benefits over Manual Process
Limitations of Excel Macros: A word of caution 2.2
1. Objects:
a. No robust mechanism to handle dynamic objects
b. More and more objects in code may lead to memory leakage
c. References can’t be handled properly
2. OS Compatibility: Exclusively used in Windows environment
Feature Manual Process Excel Macro Automation
Reliability Less reliable Most reliable
Time More time consuming Time saver
Investment Utmost required A lesser amount required
Frequency One time or based on the plan Repeatable
Productivity Depends on complexities Increases productivity and Helps to do more work
Reusability One time or based on the plan One time effort and provides reusability where monotonous task is involved
Accuracy & Quality
Depends on experience Excel macro ensures that every action is accomplished identically - ensures high quality, reliable results
3. References: Arguments or parameters are passed using procedures or functions.
If not taken care properly, this can lead to undesirable output
4. Performance: Macros are very flexible and proved to be very powerful tools, but
sometimes the number of transaction volume, the programs start taking more time
to process and generate the desired results
5. Knowledge of VBA: One has to know how to use and write programs in VBA.
Fortunately, it’s not as difficult as presumed by many
6. Version Compatibility: Upgrading Excel, Compatibility between versions, may
cause VBA code won’t work precisely with older versions or with a future versions
3. How to use Excel Macros: The building blocks
Like any automation journey, the ground rules should be set, architecture should be defined,
optimizations and ease of usability should be at your heart.
Define a Framework, but keep it simple… very simple!
Framework is defined as a real or conceptual structure created to provide support or guidance to
an application that could expand in future. A few others define it as an organization’s way of doing
things. In simple terms, a framework can be defined as a set of processes, standards and
interactions between the components.
Define Objectives 3.1
It is very important to define the objectives of Excel Macro Automation before design
1. Framework
2. Scope of automation
3. Stability of application
4. User group
5. Skillset required/availability
Excel Macro Automation Approach 3.2
Typical automation process using Excel Macros illustrated below from Feasibility to maintenance
cycle
Excel Macro Framework 3.3
File/Folder structure:
Folders consists all the test scripts, generics, readers and utilities.
Data Tables:
Rich interactive table to customize data specific to applications
Scripts:
Scripts are a critical component and contain the actual code logic to perform and validate a
specific business or functional scenario.
Driver Script:
Driver Script organizes complete script execution and exports the results to the specified path.
Function Library:
Function Libraries form the basic building blocks and define the common set of reusable
functions. A Function Library must contain the generic set of reusable functions that are usable
across the applications as well as business functions specific to the application and a few
support functions which can be reused in Generic and Business functions as needed
Results and Reporting:
Reporting mechanism should be configured so that test results generated are easily accessible and
understood.
Typical Test Delivery Approach 3.4
Return on investment (ROI) 3.5
ROI measures the amount of return on an investment to the
investment’s cost. To calculate ROI, the benefit (or return) of an
investment is divided by the cost of the investment, and the result
is expressed as a percentage or a ratio
ROI = Benefit/Investment = (Gains-
Costs)/Investment
Feature Manual Process Excel Macro Automation
Tool Cost NA Nil
Cost of scripting/test design NA $A
Cost of executing/running test $X $B
Cost of maintenance $Y $C
Total $X+$Y $A+$B+$C
ROI NA (($X+$Y)-($A+$B+$C))/($X+$Y)
3.5.1 Case study I:
Know Your Customer (KYC) is a web-based application which keeps track of
information on Money laundering Risk Assessment (MLRA) ratings associated to the
customers.
KYC process involves answering the questionnaire (approx. 110 questions) and MLRA
rating is generated based on the business logic and questionnaire.
3.5.2 Case study II:
Customer On-boarding is a web-based application which keeps track of customer information,
entitlements and Geographic details etc.
Customer on boarding process involves answering the questionnaire (approx. 300
questions).Customer on boarding process is initiated by a user and is subsequently required
approvals from six different users (Maker-checker rule)
To ease the time consuming and monotonous work, excel based automation utility has been
created. This utility simplifies the process of filling responses to 300 questions (approx.) and
executes in a single click.
3.5.3 Case Study Comparison of Manual process and Excel Macro
automation:
Sample test case illustration
Manual
Process -
KYC
Excel Macro
Automation -
KYC
Manual Process –
Customer On-
boarding
Excel Macro Automation
- Customer On-boarding
Total number of test
cases/customer to create
86 86 126 126
Time taken for creation of Utility
(Hrs.)
NA 5 NA 9
Time taken to execute one test
case/ create one customer
(Hrs.)
1 0.04 1 0.15
Time taken to execute 86 test
cases/ create 126 customers
(Hrs.)
86 3.44 126 18.9
Net Savings (Manual Effort -
Automated Effort) (Hrs.)
86-(5+3.44)= 77.56 126-(9+18.9)= 98.1
Manual Process – Case Study I & II Excel Macro Automation
Excel Macro
Benefits KYC Customer On-boarding
1. Open the KYC application 2. Log in with user 3. Fill all the
106(mandatory) questions, based on the test case pre-conditions
4. Capture all the screenshots and MLRA rating
5. Monotonous and time consuming
1. Open the Customer on boarding application
2. Log in with user 3. Fill all the 300(mandatory)
questions, based on the pre-conditions and click on submit
4. Capture all the screenshots and customer ID
5. Login with other 6 different users and approve to complete the on boarding process of a customer
1. Open the utility 2. Fill the required
fields in data sheet 3. Run the utility
1. Avoids repetitive task and maintains accuracy
2. Built on excel based VBA Macro’s, which is less complex and maintenance cost is NIL.
3. Reduces the repetitive tasks and accuracy will be maintained.
4. Capture screenshots at run time. 5. KYC Utility takes 206Mins. 4
Sec only to execute 86 regression test cases.
6. CDL Utility takes 18.9Hrs. Against manual effort of 126Hrs. to create 126 customers.
7. Test execution Effort saved by 98.1%
4. Tools comparison
5. Conclusion
Excel Macro Automation is like a magic wand to address the day to day automation
needs and Project/Engagement managers should invest in training and educating the
testing team members to exploit the benefits and enhance productivity. Further these
tools can be independently reused across accounts and locations with a few customizations
without hurting IP sentiments.
Its powerful tool in organizations inventory to help deliver quality software faster and at
presumably no cost and pass on the benefits to the customers and win some accolades
too!
Feature Excel Macros UFT Selenium
Functional Testing Yes Yes Yes
OS / Environment
support
Windows Windows Windows , Mac OS X Linux
Screenshot
capture at run
time
Yes Yes Yes
Language Support VBA VB Script Java, C#, Ruby, Python, Perl
PHP, JavaScript
Framework Non standard Standard Standard
Software Cost NIL License NIL
Coding Experience Minimal Moderate Moderate
Browser Support IE , Firefox IE, Firefox and
Chrome
Google Chrome, IE, Firefox,
Opera, HTML Unit
References
http://www.excel-easy.com/
http://www.seleniumguide.com/p/selenium-vs-qtp.html
http://www.guru99.com/alm-qtp-selenium-difference.html
http://www.excel-vba.com/excel-vba-solutions-beginners.htm
http://www.makeuseof.com/tag/how-to-automate-firefox-or-chrome-with-vba-and-
selenium/
Author Biography
Sindhuja Kumar, is Senior Software Engineer at the testing vertical (FS)
of Capgemini Technologies India ltd., Research interest is in the area of
organization designs that maximize innovative solutions. Sindhuja is
graduated from SITAMS Autonomous University in stream of E&C.
With the first project experience in capgemini, has taken an additional
responsibility in creating a wiki (KM) document on Trade finance
business which will be helpful for the new folks who will step in new to the
project with Zero knowledge.
The idea of this white paper is an initiative taken from automating web
application using EXCEL MACROS, which is recognized at the
organization level.
THANK YOU!