86

Clean & Dirty Acceptance Tests with Cucumber & Watir

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Clean & Dirty Acceptance Tests with Cucumber & Watir
Page 2: Clean & Dirty Acceptance Tests with Cucumber & Watir

���2

iRedeem Testing Automation Strategy

Page 3: Clean & Dirty Acceptance Tests with Cucumber & Watir

���3

Levels of Automated Testing

Page 4: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Page 5: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests

Page 6: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests

System Integration Tests

Page 7: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests

System Integration Tests

Acceptance Criteria Tests

Page 8: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests

System Integration Tests

Acceptance Criteria Tests

Regression Testing

Page 9: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests PHP Unit

System Integration Tests

Acceptance Criteria Tests

Regression Testing

Page 10: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests PHP Unit

System Integration Tests ??

Acceptance Criteria Tests

Regression Testing

Page 11: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests PHP Unit

System Integration Tests ??

Acceptance Criteria Tests Cucumber & Watir

Regression Testing

Page 12: Clean & Dirty Acceptance Tests with Cucumber & Watir

���4

Levels of Automated Testing

Unit Tests PHP Unit

System Integration Tests ??

Acceptance Criteria Tests Cucumber & Watir

Regression Testing [Everything]

Page 13: Clean & Dirty Acceptance Tests with Cucumber & Watir

���5

Disadvantages of UI Automation using Selenium

or Watir

Page 14: Clean & Dirty Acceptance Tests with Cucumber & Watir

���6

Disadvantages of UI Automation using Selenium or Watir

Page 15: Clean & Dirty Acceptance Tests with Cucumber & Watir

���6

Disadvantages of UI Automation using Selenium or Watir

Brittle

Page 16: Clean & Dirty Acceptance Tests with Cucumber & Watir

���6

Disadvantages of UI Automation using Selenium or Watir

Brittle

Time-consuming to Write and Maintain

Page 17: Clean & Dirty Acceptance Tests with Cucumber & Watir

���6

Disadvantages of UI Automation using Selenium or Watir

Brittle

Time-consuming to Write and Maintain

Time-consuming to Execute

Page 18: Clean & Dirty Acceptance Tests with Cucumber & Watir

���7

An Aside: Why does execution time matter?

Page 19: Clean & Dirty Acceptance Tests with Cucumber & Watir

���7

An Aside: Why does execution time matter?

Sagar checks in code and the tests run

Page 20: Clean & Dirty Acceptance Tests with Cucumber & Watir

���7

An Aside: Why does execution time matter?

Sagar checks in code and the tests run

Bogdan checks in code an hour later. The tests run

Page 21: Clean & Dirty Acceptance Tests with Cucumber & Watir

���7

An Aside: Why does execution time matter?

Sagar checks in code and the tests run

Bogdan checks in code an hour later. The tests run

Two hours later, the build has broken.

Page 22: Clean & Dirty Acceptance Tests with Cucumber & Watir

���7

An Aside: Why does execution time matter?

Sagar checks in code and the tests run

Bogdan checks in code an hour later. The tests run

Two hours later, the build has broken.

Who broke it?

Page 23: Clean & Dirty Acceptance Tests with Cucumber & Watir

���8

Someone would have to bother checking

Page 24: Clean & Dirty Acceptance Tests with Cucumber & Watir

���9

Disadvantages of UI Automation using Selenium or Watir

Brittle

Time-consuming to Write and Maintain

Time-consuming to Execute

Page 25: Clean & Dirty Acceptance Tests with Cucumber & Watir

���10

How do we minimize these disadvantages?

Page 26: Clean & Dirty Acceptance Tests with Cucumber & Watir

���11

How do we minimize these?

Page 27: Clean & Dirty Acceptance Tests with Cucumber & Watir

���11

How do we minimize these?

1. Reduce the number of tests.

Page 28: Clean & Dirty Acceptance Tests with Cucumber & Watir

���11

How do we minimize these?

1. Reduce the number of tests.

2. Reduce the coupling between tests and data (or make our own data)

Page 29: Clean & Dirty Acceptance Tests with Cucumber & Watir

���11

How do we minimize these?

1. Reduce the number of tests.

2. Reduce the coupling between tests and data (or make our own data)

3. Reduce the time it takes to write and modify tests.

Page 30: Clean & Dirty Acceptance Tests with Cucumber & Watir

���12

1. Business Acceptance Criteria

Page 31: Clean & Dirty Acceptance Tests with Cucumber & Watir

���13

Business Acceptance Criteria

Page 32: Clean & Dirty Acceptance Tests with Cucumber & Watir

���13

Business Acceptance Criteria

Core User Paths

Page 33: Clean & Dirty Acceptance Tests with Cucumber & Watir

���13

Business Acceptance Criteria

Core User Paths

Business-critical Stuff

Page 34: Clean & Dirty Acceptance Tests with Cucumber & Watir

���13

Business Acceptance Criteria

Core User Paths

Business-critical Stuff

Cannot be allowed to fail

Page 35: Clean & Dirty Acceptance Tests with Cucumber & Watir

���13

Business Acceptance Criteria

Core User Paths

Business-critical Stuff

Cannot be allowed to fail

Run on CI with every commit

Page 36: Clean & Dirty Acceptance Tests with Cucumber & Watir

���13

Business Acceptance Criteria

Core User Paths

Business-critical Stuff

Cannot be allowed to fail

Run on CI with every commit

Small and very maintainable

Page 37: Clean & Dirty Acceptance Tests with Cucumber & Watir

���14

2. Test Data

Page 38: Clean & Dirty Acceptance Tests with Cucumber & Watir

���15

Test Data

Page 39: Clean & Dirty Acceptance Tests with Cucumber & Watir

���15

Test Data

Defaults Stored in YAML files

Page 40: Clean & Dirty Acceptance Tests with Cucumber & Watir

���15

Test Data

Defaults Stored in YAML files

Koinos and Megento Web APIs used

Page 41: Clean & Dirty Acceptance Tests with Cucumber & Watir

���15

Test Data

Defaults Stored in YAML files

Koinos and Megento Web APIs used

Scenario Independence

Page 42: Clean & Dirty Acceptance Tests with Cucumber & Watir

���16

3. Abstractions and Data Models

Page 43: Clean & Dirty Acceptance Tests with Cucumber & Watir

���16

3. Abstractions and Data Models

Data from YAML Files easily available

Page 44: Clean & Dirty Acceptance Tests with Cucumber & Watir

���17

Page 45: Clean & Dirty Acceptance Tests with Cucumber & Watir

���18

Page 46: Clean & Dirty Acceptance Tests with Cucumber & Watir

���19

3. Abstractions and Data Models

Data from YAML Files easily available

Page 47: Clean & Dirty Acceptance Tests with Cucumber & Watir

���19

3. Abstractions and Data Models

Data from YAML Files easily available

Data Models to maintain state between steps

Page 48: Clean & Dirty Acceptance Tests with Cucumber & Watir

���20

Page 49: Clean & Dirty Acceptance Tests with Cucumber & Watir

���21

3. Abstractions and Data Models

Data from YAML Files easily available

Data Models to maintain state between steps

Page 50: Clean & Dirty Acceptance Tests with Cucumber & Watir

���21

3. Abstractions and Data Models

Data from YAML Files easily available

Data Models to maintain state between steps

And for Comparison

Page 51: Clean & Dirty Acceptance Tests with Cucumber & Watir

���22

Page 52: Clean & Dirty Acceptance Tests with Cucumber & Watir

���23

3. Abstractions and Data Models

Data from YAML Files easily available

Data Models to maintain state between steps

And for Comparison

Page 53: Clean & Dirty Acceptance Tests with Cucumber & Watir

���23

3. Abstractions and Data Models

Data from YAML Files easily available

Data Models to maintain state between steps

And for Comparison

UI automation for often-used Model-tasks

Page 54: Clean & Dirty Acceptance Tests with Cucumber & Watir

���24

Page 55: Clean & Dirty Acceptance Tests with Cucumber & Watir

���25

Page 56: Clean & Dirty Acceptance Tests with Cucumber & Watir

���26

3. Abstractions and Data Models

Data from YAML Files easily available

Data Models to maintain state between steps

And for Comparison

UI automation for often-used Model-tasks

Page 57: Clean & Dirty Acceptance Tests with Cucumber & Watir

���26

3. Abstractions and Data Models

Data from YAML Files easily available

Data Models to maintain state between steps

And for Comparison

UI automation for often-used Model-tasks

Page Objects to represent pages under test

Page 58: Clean & Dirty Acceptance Tests with Cucumber & Watir

���27

Page 59: Clean & Dirty Acceptance Tests with Cucumber & Watir

���28

Exploratory Testing with Cucumber

Page 60: Clean & Dirty Acceptance Tests with Cucumber & Watir

���29

Exploratory Testing with Cucumber

Page 61: Clean & Dirty Acceptance Tests with Cucumber & Watir

���29

Exploratory Testing with Cucumber

Needs to be quick

Page 62: Clean & Dirty Acceptance Tests with Cucumber & Watir

���30

Exploratory Testing with Cucumber

So it will probably be dirty

Page 63: Clean & Dirty Acceptance Tests with Cucumber & Watir

���31

Separating Concerns

Clean Code Dirty Code

Must always Pass

Business AC

Small Suite

Can switch off

Bugs / Fine-grained

Larger Suite

Page 64: Clean & Dirty Acceptance Tests with Cucumber & Watir

���32

Exploratory Testing with Cucumber

Page 65: Clean & Dirty Acceptance Tests with Cucumber & Watir

���33

Given a Bug…

Page 66: Clean & Dirty Acceptance Tests with Cucumber & Watir

���34

Given a bug…

Page 67: Clean & Dirty Acceptance Tests with Cucumber & Watir

���34

Given a bug…

1. Write a quick (and brittle) feature file

Page 68: Clean & Dirty Acceptance Tests with Cucumber & Watir

���35

Page 69: Clean & Dirty Acceptance Tests with Cucumber & Watir

���36

Given a bug…

1. Write a quick (and brittle) feature file

Page 70: Clean & Dirty Acceptance Tests with Cucumber & Watir

���36

Given a bug…

1. Write a quick (and brittle) feature file

2. Write some quick (and dirty) step definitions

Page 71: Clean & Dirty Acceptance Tests with Cucumber & Watir

���37

Page 72: Clean & Dirty Acceptance Tests with Cucumber & Watir

���38

Given a bug…

1. Write a quick (and brittle) feature file

2. Write some quick (and dirty) step definitions

Page 73: Clean & Dirty Acceptance Tests with Cucumber & Watir

���38

Given a bug…

1. Write a quick (and brittle) feature file

2. Write some quick (and dirty) step definitions

3. Check it Fails correctly

Page 74: Clean & Dirty Acceptance Tests with Cucumber & Watir

���38

Given a bug…

1. Write a quick (and brittle) feature file

2. Write some quick (and dirty) step definitions

3. Check it Fails correctly

4. Commit and assign ticket to Devs

Page 75: Clean & Dirty Acceptance Tests with Cucumber & Watir

���39

When it comes back to FT?

Page 76: Clean & Dirty Acceptance Tests with Cucumber & Watir

���39

When it comes back to FT?

$ rake t @jira-ird-787

Page 77: Clean & Dirty Acceptance Tests with Cucumber & Watir

���40

Regression Testing

Page 78: Clean & Dirty Acceptance Tests with Cucumber & Watir

���41

If a Dirty Test Fails?

Page 79: Clean & Dirty Acceptance Tests with Cucumber & Watir

���41

If a Dirty Test Fails?

Is it the test, or the product?

Page 80: Clean & Dirty Acceptance Tests with Cucumber & Watir

���41

If a Dirty Test Fails?

Is it the test, or the product?

Fix the test

Page 81: Clean & Dirty Acceptance Tests with Cucumber & Watir

���41

If a Dirty Test Fails?

Is it the test, or the product?

Fix the test

Or turn it off!

Page 82: Clean & Dirty Acceptance Tests with Cucumber & Watir

���42

Separating Concerns

Business AC Given… When… Then…

Dirty ScenariosYAML Data

Data Models EnvConfig Product Category Member

Page Objects DashboardPage MemberLoginPage

ProductDetailsPage etc…

Step Definitions Step Definitions

Dirty Page Objects

Page 83: Clean & Dirty Acceptance Tests with Cucumber & Watir

���43

Dirty > Clean

Page 84: Clean & Dirty Acceptance Tests with Cucumber & Watir

���44

Questions?

Page 85: Clean & Dirty Acceptance Tests with Cucumber & Watir

���45

That’s It

Page 86: Clean & Dirty Acceptance Tests with Cucumber & Watir