Automation strategies for agile testing Gaurav bansal

14
www.agiletour.org Automation Strategies for Agile Testing “Is your automation testing “Agile” or “Fragile”? Gaurav Bansal

Transcript of Automation strategies for agile testing Gaurav bansal

Page 1: Automation strategies for agile testing  Gaurav bansal

www.agiletour.org

Automation Strategies

for Agile Testing “Is your automation testing

“Agile” or “Fragile”?

Gaurav Bansal

Page 2: Automation strategies for agile testing  Gaurav bansal

Agenda

Why use automation in Agile Projects?

Selecting Automation Strategy

Record and Playback. Right Choice?

Design patterns for test automation

Best Practices

Page 3: Automation strategies for agile testing  Gaurav bansal

Why automation in agile projects?

A

Page 4: Automation strategies for agile testing  Gaurav bansal

Selecting Automation Strategy

Licenced Tools

Light weight Record and Playback

Automation Framework using Open Source Tools

Page 5: Automation strategies for agile testing  Gaurav bansal

Automation Framework (Using Open Source Tools)

Typical Issues:

• Hard Coded Values

• Duplicate Code

• No Data Driven Testing

• No Exception Handling

• God Object Pattern

• Brittle Locators

• Fragile Test Scripts

• Liability rather than Asset

Page 6: Automation strategies for agile testing  Gaurav bansal

Possible Solutions..

Build Abstraction to avoid code duplication

What If we moved the page-specific behavior into a corresponding class?

Voila! The Page Object is born.

Page 7: Automation strategies for agile testing  Gaurav bansal

The Page Object

The Page Object pattern represents the screens of your web app as a series of objects.

The page object contains all the services offered by a particular page.

Consolidates the code for interacting with any given UI element.

Exposes methods that reflect the things a user can see and do on that page, e.g.

• loginSuccessfully(),

• searchKeyword(), addOrder(), getFilter(), openDetails()

• seeMore(), closeDetails(), showSearch()

Hides the details of telling the browser how to do those things.

Page 8: Automation strategies for agile testing  Gaurav bansal

Build UI Repository

Easily maintain your test components when an object in your application changes.

No need to modify the script when object properties changes.

Easy to identify objects in AUT by Object Logical Names.

Can be created independently from scripts.

Page 9: Automation strategies for agile testing  Gaurav bansal

Make tests Data Driven

Allows to develop automated test scripts that are more generic, requiring only that the input and expected results be updated.

Information like data inputs or outputs, expected results get stored in the form of conveniently managed text records.

Page 10: Automation strategies for agile testing  Gaurav bansal

Reporting features for Automation

Report should provide where errors occurred and using which test data.

Should be easily sharable.

Details for each step execution.

Snapshots for failed tests.

Customizable reporting.

Automated notifications on failure or reaching threshold level.

Should have instrumentation for debugging purpose.

Page 11: Automation strategies for agile testing  Gaurav bansal

Continuous Integration

Constant availability of a “current” build.

Detect and fix integration problems continuously.

Early warning of incompatible code.

Immediate automated testing of all changes.

Immediate feedback to developers

Useful Metrics

Page 12: Automation strategies for agile testing  Gaurav bansal

Best Practices

Avoid Duplicate Code

Don't swallow Exceptions

Don't use brittle locators

Avoid Pesticide Paradox : Parameterize test data

Create and leverage GUI Map

Write reusable modules for common test functions.

Make tests atomic

Readable and maintainable code

Automation Handover

Page 13: Automation strategies for agile testing  Gaurav bansal

Best Practices (Contd..)

Page 14: Automation strategies for agile testing  Gaurav bansal

Email: [email protected]; @gaurav_bansal