automation framework

34
© 2001 LogiGear Corporation. All Rights Reserved. The Design and Implementation of a Flexible, Reusable, and Maintainable Automation Framework Hung Q. Nguyen LogiGear ® Corporation

Upload: mehramit

Post on 30-Nov-2014

25.850 views

Category:

Business


4 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

The Design and Implementationof a Flexible, Reusable, andMaintainable AutomationFramework

Hung Q. NguyenLogiGear® Corporation

Page 2: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

Objectives

• Prepare you to build a successful andreusable automation architecture

• Share the keyword approach to creating anautomation framework

• Share lessons learned in implementing aflexible architecture

Page 3: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

Background: The Evolution

• The early days

• Developing an automation framework

• The table-driven approach

• The keyword-driven approach

Page 4: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

The Early Days

• Collect acceptance/regression test cases tobe automated

• Record and script test cases

• Improve reusability– Parameterize hard-coded values

– Separate data from code by moving variables toINCLUDE files

– Create utility functions to be shared

• Train test specialists to run scripts

Page 5: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Work with test specialists to understandtheir testing needs

• Go beyond acceptance/regression tests--Analyzing user-scenario test cases

• Recognize the difference between task-driven and object-driven test cases

The Next Wave:Creating a Framework

Page 6: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Object-Driven– Click User Name text box

– Enter your_ID

– Click Password text box

– Enter your_password

– Click Login button

• Task-Driven– Log in using

• User Name = your_ID

• Password = your_password

Object-Driven vs. Task-Driven

Page 7: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Pre-separating data and code– Start by defining functions to be written

– Variablize data and keep variables in INCLUDE files

• Pair up a test specialist and an automationengineer to improve communication and toensure that the framework design andimplementation meet the test objectives

• Train test specialists to run test scripts

The Next Wave:Creating a Framework

Page 8: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Take advantage of tester’s familiarity with test casecreation using tables and matrices

• Accommodate localization projects

• Recognize the importance of patterns in test cases

• Enable testers to catalog test cases with Excelspreadsheets

• Enable testers to specify expected results inspreadsheets

The Table-Driven Approach

Page 9: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

A Table-Driven Example

Page 10: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

A Table-Driven Example

• for (i=1; i<= iLastDataSet;i++)– Open the dialog box.

– Use the data in DataSet[i] (Thefirst set is 1 and the last set is12) to set the values of MatchCase, Match Whole Word andFind What controls.

– Click Find Next.

– Verify the results.

PROPERTYCONTROL 1 2 3 4 5 6 7 8 9 10 11 12

Match case OF

F

OF

F

ON

ON

OF

F

OF

F

ON

ON

OF

F

OF

F

ON

ON

Match whole OF

F

ON

OF

F

ON

OF

F

ON

OF

F

ON

OF

F

ON

OF

F

ON

Find What "UP

PE

RC

AS

E"

"UP

PE

RC

AS

E"

"UP

PE

RC

AS

E"

"UP

PE

RC

AS

E"

"low

erca

se"

"low

erca

se"

"low

erca

se"

"low

erca

se"

"Mix

edC

ase"

"Mix

edC

ase"

"Mix

edC

ase"

"Mix

edC

ase"

Page 11: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Business issues

• People and process issues

• Technology issues

The Need for Improvement

Page 12: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Need to expand our service offerings andshare success through our test automationexpertise

• Need to have a methodology for quickdeployment of test automation

• Need to build a transferable architecture

• Need a better approach to test automationjob costing

The Business Issues

Page 13: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Need to deliver an automation program that ispractical, explainable, and trainable

• Need to be more cost effective throughreusability across projects

• Need to make technology a viable businesssolution

• Need a tangible approach to deciding betweenmanual testing and automated testing

The Business Issues

Page 14: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Need to standardize test methodology--Enabling testers and automation engineersto collaborate

• Enable testers to better specify their needsand automation engineers to better servethose needs

• Need to integrate test automation as part ofthe process of software testing

The People and Process Issues

Page 15: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Need testers to focus on test case design,and automation engineers to focus ondriver script writing

• Make data more visible and understandablefrom the human perspective

• Need to incorporate test case designtechniques with Excel, which testspecialists are already familiar

The People and Process Issues

Page 16: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Need to build an architecture that’s toolindependent as well as application independent

• Need to improve the ability to share code acrossprojects and tools

• Need to separate control of task variables, inputvariables, and code

• Need to integrate action keyword into theexisting data-driven model

The Technology Issues

Page 17: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Want to focus the development andmaintenance of test scripts on thenavigation of the application under test

• Need to take advantage of Excel features toautomate test case and test data creation

• Need to incorporate test case designtechniques using Excel, any database,XML, or other viable data service solutions

The Technology Issues

Page 18: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

Integrated Testing Solutions =

[Test Specialist’s Domain Expertise] +

[Manual Testing] +

[Automated Testing: Reusable Framework & Application Specific Scripts]

The Integrated Solution

Page 19: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Research possible solutions and evaluate options

• Develop requirements

• Develop the architecture

• Build the framework

• Test the framework

• Develop documentation

• Deploy the framework on a real project

• Measure performance and refine the design

The Development Process

Page 20: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Learn from past experience

• Discuss possibilities with software developers

• Talk to friends

• Read books– Recommend “Software Test Automation” by Graham and

Fewster, 1999, Addison-Wesley

• Use the Internet– Recommend www.QACity.com, the Automated Testing page

Research Possible Solutions

Page 21: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Clearly state the business, people/process, andtechnology objectives

• Set expectations through well defined deliverables(e.g., requirement and design documents, codemodules, whitepapers, training materials, etc.)

• Clearly define ways to measure success (e.g.,quality of the design and code, budget, schedule,customer approval upon deployment, etc.)

The Requirements

Page 22: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

Application Independent Tool/Application Dependent

Keyword Architecture

Test Designer Test Interpreter Test Driver

Data Services Business Logic Dispatching Services

Driver Scripts

Test Execution Services

The Architecture

Application Under Test(AUT)

Page 23: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

The ArchitectureKeyword Architecture

Test Designer Test Interpreter Test Driver

FileName Main() GetTaskName GetTaskRows RunTestCase GetTaskParameters etc.

Driver Scripts

testcase Login(parameters) etc.

Database

XML

Page 24: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

The Architecture

driverscripts.t

interpreter.inc

testdriver.t

Page 25: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

The Architecture:The Test Designer

MyWorksheet.xls = MyTestplan.xls

Sheet1 = TestSuite1

Sheet2 = TestSuite2

C1 C2 C3 C4R1 Test Case 1R2 Test Case 2

Page 26: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

The Architecture:The Test Designer

Test Plan

Test Suite

Page 27: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

The Architecture: The Report

Test suite

Test section

Test case

Test line &equivalentspreadsheetrow number

Page 28: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Prototype the components

• Implement the Test Designer

• Implement the Test Interpreter

• Implement AUT specific Test Drivers

• Add the reporting function to the TestInterpreter

• Test, fix bugs, and write documentation

Building the Framework

Page 29: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Clear requirements help focus the team on the importantissues.

• Leaving “Fill in the blank” sections in requirements ismanageable.

• Spending time on designing and prototyping helps flushout design issues; making it more scaleable, and helpingwrite more maintainable code.

• If the project is overly complex and the schedule isaggressive, you may need to scale back. Don’t forget tocommunicate changes in your plan.

Lessons Learned

Page 30: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• The necessary information is available! We need a wayto find and analyze relevant information more quicklyand effectively.

• Thoroughly research your options. Choose your designswisely by taking business issues, people and processissues, and technology issues into consideration.

• Keep in mind that your solution might be used by onegroup, and maintained by another group.

Lessons Learned

Page 31: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

• Your effort is a serious development project. Treat it assuch: The key to success is good planning, schedulingand budgeting.

• Get feedback! How else can you learn?

• It won’t be perfect! It’s acceptable to learn frommistakes and refine the design as you go. Iteration andhard work make perfection.

• The keyword approach works!

Lessons Learned

Page 32: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

Special thanks to Hans Buwalda for sharing hisexperience and vision on the action-word approach tocreating test automation framework.

Acknowledgment

Page 33: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

About Hung Q. Nguyen

Hung Q. Nguyen is Founder, President and CEO of LogiGear Corporation, a SiliconValley software testing company whose mission is to help software developmentorganizations deliver the highest quality products possible while juggling limitedresources and schedule constraints. LogiGear offers many value-added services includingapplication testing, automated testing and web load/performance testing for e-businessand consumer applications. Nguyen’s company produces and markets TRACKGEAR™,a web-based defect tracking system. LogiGear also specializes in Web application, hand-held communication device and consumer electronic product testing, and offers thesoftware development community a comprehensive “Practical Software Testing TrainingSeries.” In the past two decades, Nguyen has held leadership roles in businessdevelopment, engineering, quality assurance, testing, product development, andinformation technology. Nguyen is the author of Testing Applications on the Web (Wiley)and co-author of the best-selling book, Testing Computer Software (Wiley). He alsodevelops and teaches software testing courses for UC Berkeley and UC Santa CruzExtension, and for LogiGear. He holds a Bachelor of Science in Quality Assurance fromCogswell Polytechnical College, and is an ASQ-Certified Quality Engineer and activesenior member of American Society for Quality.

Page 34: Automation Framework

© 2001 LogiGear Corporation. All Rights Reserved.

About LogiGear® Corporation

LogiGear® Corporation is a full service software quality-engineering firm that provides testing expertise and resources tosoftware development organizations. Some of our value-addedservices include application testing, automated testing, and webload/performance testing for e-business and consumer applications.LogiGear specializes in Web application, hand-heldcommunication device, and consumer electronic product testing.LogiGear also produces and markets TRACKGEAR™, a Web-based defect-tracking solution, and offers QA Training through thePractical Software Testing Training Series.

www.logigear.com