Automation strategies for agile testing Gaurav bansal

Preview:

Citation preview

www.agiletour.org

Automation Strategies

for Agile Testing “Is your automation testing

“Agile” or “Fragile”?

Gaurav Bansal

Agenda

Why use automation in Agile Projects?

Selecting Automation Strategy

Record and Playback. Right Choice?

Design patterns for test automation

Best Practices

Why automation in agile projects?

A

Selecting Automation Strategy

Licenced Tools

Light weight Record and Playback

Automation Framework using Open Source Tools

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

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.

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.

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.

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.

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.

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

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

Best Practices (Contd..)

Email: gbansal@xebia.com; @gaurav_bansal

Recommended