47
Brace yourself from the Automation Trap Prasad Kalgutkar

Brace yourself from automation death trap

Embed Size (px)

Citation preview

Page 1: Brace yourself from automation death trap

Brace yourself from the

Automation TrapPrasad

Kalgutkar

Page 2: Brace yourself from automation death trap
Page 3: Brace yourself from automation death trap

Why we Automate?

Page 4: Brace yourself from automation death trap

Fast Feedback

Input

Result

Page 5: Brace yourself from automation death trap

Save Time & Money

Perform Exploratory TestingAnalyze future requirementsDeliver on time

Page 6: Brace yourself from automation death trap

Then why we fail?

Page 7: Brace yourself from automation death trap

Too much of unwanted

automationSource: http://www.energizers.com/portfolio-view/entangled

Page 8: Brace yourself from automation death trap

Automation done Perfunctory!

Damn! We have agreed to

automate, let me write some tests

Page 9: Brace yourself from automation death trap

“Are we building it correctly?”

Page 10: Brace yourself from automation death trap

My journey of challenges

Page 11: Brace yourself from automation death trap

eCommerce

Train Travel

Airline Travel

Page 12: Brace yourself from automation death trap

Airline domain with a big Enterprise Org StructureMobile App Development & Frequent ReleasesMixed Skilled Testing TeamDistributed team across 4 locations

Page 13: Brace yourself from automation death trap

As a Agile QA,What it meant

to me?

Page 14: Brace yourself from automation death trap

…automation serving

as a help&

not an overhead!

Page 15: Brace yourself from automation death trap

Some food for thought!

Page 16: Brace yourself from automation death trap

#1Let automation run in

the blood!

Page 17: Brace yourself from automation death trap

Be thoughtful while automating

Design &

ToolsClean Coding

How much?

&Where

to?

Runs on CI

QA Build from

CI

Page 18: Brace yourself from automation death trap

# Break the silos in testing

# Every QA, contributes to automation

# Best when

business refers your test-cases

Page 19: Brace yourself from automation death trap

Let’s Refactor!

Fail Fast,Grow Right!

Add,Delete,Merge!

Optimize as you

proceed

Page 20: Brace yourself from automation death trap

#2Aim for the Test

Pyramid

Page 21: Brace yourself from automation death trap

Test PyramidManual /

Exploratory

Impact

Business

FacingTests

Technology FacingTests

TimeCost

Integration

JavaScript

Web Service

UI

Unit

View

Courtesy: Anand Bagmar-What is Agile Testing?

Page 22: Brace yourself from automation death trap

# Unit TestsFor iOS, Android, MWeb codeDevs own while doing TDD # Integration

TestsDevs own while doing TDD

# Functional TestsFocus only E2EQAs/Devs own it # GUI E2E

TestsFocus on UI detailsQAs/Devs own it

Page 23: Brace yourself from automation death trap

#3Strongly dependent on OOPs concepts

Page 24: Brace yourself from automation death trap

We usedPage Objects

User ProfileInformation

AccountsHistoryTransfers Apply

Loan

Account Balance

Open Demat

Home Page

Page 25: Brace yourself from automation death trap

The right way...

● Has only required user services

● Knows about the Locators & Next Navigation!

● Delegates user actions to Driver

● Registered with Page Registry

User ProfileInformation

AccountsHistoryTransfers Apply

Loan

Account Balance

Open Demat

Home Page

Page 26: Brace yourself from automation death trap

DefineHard-

workingDriver

Page 27: Brace yourself from automation death trap

The Driver,

=> Provides actions to Page

Objects

=> May have setup methods

=> Takes care of Waits

Page 28: Brace yourself from automation death trap

Single Test Layer⇒

Invokes single step implementation

⇒Calls relevant

Page Objects⇒

Respective library do user actions

Our Eco-system

Page 29: Brace yourself from automation death trap

#4Test Cases: Try Behavior Driven

Page 30: Brace yourself from automation death trap

How Cukes helped …

=> Scenarios are E2E only

=> Acted as the Framework

=> Everyone collaborates!

Given a ...

When I ...

Then I ...

Scenario : To test...

Page 31: Brace yourself from automation death trap

Do’s

●Build independent test scenarios grouped in functional chunks

● If not cukes, provide sensible names to the tests

●Avoid setups in test-cases layer

Page 32: Brace yourself from automation death trap

#5Maintainable Test

Data

Page 33: Brace yourself from automation death trap

Keep it understan

dable

Keep it close to domain

Keep it simple

Page 34: Brace yourself from automation death trap

In the scenario...

Page 35: Brace yourself from automation death trap

WhenI search for flight with|origin |destination |type || BOM | DEL | One way|

ThenI should get “13A” as “aisle” seat

Page 36: Brace yourself from automation death trap

Test Data Hash...

Page 37: Brace yourself from automation death trap

When I enter “VISA” card details

Def testCards {“VISA” => {

“Num” => “400010004000”

“Exp Month” => “10”

“Exp Year” => “},“AMEX” => {

………

},}

Page 38: Brace yourself from automation death trap

Test Data Objects...

Page 39: Brace yourself from automation death trap

GivenI have a “delayed_multi_pax” PNR in my trips

some_step_def_method(type){

myPnr =PnrFactory.getPnr(type)...}

Page 40: Brace yourself from automation death trap

Avoid data sheets or

CSVs

Leverage the

tech stack

Avoid data fetching from DB

Page 41: Brace yourself from automation death trap

#6Test the Framework

Page 42: Brace yourself from automation death trap

B’coz,

●Drivers, Page Objects are core!

●As the project grows, so do the contributors!

●When automation is the backbone of project delivery

Page 43: Brace yourself from automation death trap

“Get them running…”

Get Continuous Integration

Page 44: Brace yourself from automation death trap

“ …is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day…Each integration is verified by an automated build to detect integration errors as quickly as possible … “

- Martin Fowler, ThoughtWorks Chief Scientisthttp://www.thoughtworks.com/continuous-integration

Continuous Integration

Page 45: Brace yourself from automation death trap

“Every experience, no

matter how bad it seems…

Holds a blessing of some kind”

- Gautam Buddha

Page 46: Brace yourself from automation death trap

Thank You

Page 47: Brace yourself from automation death trap