Top Banner
How to misuse 'Automation' for testing, fun and productivity TestBash Netherlands 2017 Alan Richardson www.eviltester.com www.seleniumsimplified.com www.javafortesters.com www.compendiumdev.co.uk uk.linkedin.com/in/eviltester @eviltester
54

Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Feb 09, 2017

Download

Software

Alan Richardson
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

How to misuse 'Automation' for testing, fun and productivityTestBash Netherlands 2017Alan Richardson

—www.eviltester.com—www.seleniumsimplified.com—www.javafortesters.com—www.compendiumdev.co.uk—uk.linkedin.com/in/eviltester—@eviltester

Page 2: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Tempt

"entice or try to entice (someone) to do something that they find attractive but know to be wrong or unwise."

Warned Google on 16th January 2017

"persuade (someone) to do something."

Page 3: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

What does 'misuse' mean?

"use (something) in the wrong way or for the wrong purpose."

sayeth Google on the 16th January 2017

Page 4: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

What do 'testers' do?Use or Misuse?

Page 5: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Who says the use is 'wrong'?

"use (something) in the wrong way or for the wrong purpose."

—Beliefs—Conceptions and Perceptions of Reality—Opinions

Page 6: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Oh mighty Google, what pray tell is "Automation"?

"the use or introduction of automatic equipment in a manufacturing or other process or facility."

Google's proferred definition on 16th January 2017

Page 7: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

What is a 'tool'?

"a device or implement, especially one held in the hand, used to carry out a particular function. e.g. 'gardening tools'"

thus spake Google to me on 20th August 2016

Page 8: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

But I'm using software!OK.

Page 9: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Definition of: tool

"(1) A program used for software development or system maintenance. Virtually any program or utility that helps programmers or users develop applications or maintain their computers can be called a tool."

thus spake PCMag.com

Page 10: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

What is a testing tool?

What have you heard "That's not a testing tool!" in relation to?

—BDD? —Cucumber? —Selenium? see more 'not a testing tool' on Google

Page 11: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

I used to say:

"any software that I use to support my testing is a Testing Tool"

Me

Page 12: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

So What?

"If the patient wishes to argue that his conception of reality is correct, we must be willing to discuss his opinions, but we must not fail to emphasize that our main interest is his behavior than his attitude"

'Reality Therapy' by William Glasser, 1965, page 28

Page 13: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

I now say

"any software that I use to support my testing I view as a Testing Tool"

Me

Page 14: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Cards As Weapons

The key word is "AS", not "IS"

Page 15: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Korzybski said "The word is not the thing"

—Cucumber is not a testing tool. —It is a vegetable.

—But "cucumber" is not a vegetable.—"cucumber" is a word.

Page 16: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Horticulture for a better world"Eighteen-foot tomato plants and cucumbers the size of watermelons"

Page 17: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Which brings me back on to madness.

Page 18: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Care about Behaviour

"In Reality Therapy we are much more concerned with behavior than with attitudes."

'Reality Therapy' by William Glasser, 1965, page 27

Page 19: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

ZX Spectrum and Clive Sinclair

"...Sir Clive Sinclair himself is often reticent to discuss the machine - seeing the popularity of the system for gaming, rather than serious computing, as an insult to his creation."

bit-tech.net/news/hardware/2012/04/23/zx-spectrum-30-years/1

Page 20: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Our Model vs The World

—Our model of the world—Our model of our creation—Our model of 'correct' usageThe world often has other ideas

Page 21: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Books are not a monitor stand

Page 22: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Thomas S. Szasz

"...if our aim is to see things clearly, rather than to confirm popular beliefs and justify accepted practices, then we must sharply distinguish three related but distinct classes of phenomena:1) events and behaviours2) explanations3) social controls"

Thomas S. Szasz, "The Manufacture of Madness", 1973, Paladin Books, pg 21

Page 23: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Why - Beliefs, Explanations

"In Reality Therapy, therefore, we rarely ask why. Our usual question is What? What are you doing - not, why are you doing it?"'Reality Therapy' by William Glasser, 1965, page 32

Page 24: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

An Abstraction Model

Thomas Szasz has used a layered/levelled/abstraction model.

—what it does—how we model it—how we expect people to use it

At which level does "Cucumber is not a testing tool" sit?

Page 25: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Tool Events and Behaviours

—What it does is immutable. —It does what it does.

Page 26: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Social Controls & Explanations

—Models are mutable, and different per person.

Page 27: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

About Cucumber - Social Controls

—"Cucumber is not a testing tool" (general hearsay)—"Cucumber is for Behaviour-Driven

Development" (cucumber.io)

Page 28: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

About Cucumber - Explanations

—"An open-source tool for executable specification"

—"Cucumber merges specification and test documentation into one cohesive whole."

(cucumber.io)

Page 29: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Models of Cucumber?

—Collaboration tool—Communication tool—Test automation tool—Automation tool—Testing Tool—Specification Tool—?

Page 30: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

About Cucumber - Events and Behaviours

—Create Text File - written in Gherkin—Write Code—Annotate Code with a REGEX to match text—Execute Text File

Page 31: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

"Regex based parser for building custom Domain Specific Languages"

we could also describe it as an interpreter

Page 32: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Evidence & Examples

Feature: Can login to the application

Background: A user can login to the application

We want the user to login because every user has their own projects and they can't be shared between users

Scenario: Login with valid credentials Given a default user When the default user logs in Then they are taken to their account home page

Page 33: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

More Evidence & Examples

Scenario: Login with valid credentials Given a default user

—custom DSL—parsed by Cucumber @Given("^a default user$") public void a_default_user() throws Throwable { tracksAccount = new TracksAccount(); }

—regex based annotations

Page 34: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Misuse as FACTWhen I use a "Regex based parser for building custom Domain Specific Languages" as part of my testing process then I can use it as a test tool.

Page 35: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

New Model, New Skills

—REGEX—Domain Specific Language—Modelling Declaratively—Data Separation—etc.

Page 36: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

RestAssured

RestAssured is a Java DSL based REST Testing Library with a "Given, When, Then" syntax.

Is it?

Page 37: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

This is RestAssured

@Test public void aUserCanNAccessWithBasicAuthHeader(){

given(). contentType("text/xml"). auth().preemptive().basic("user", "bitnami"). expect(). statusCode(200). when(). get("http://192.168.17.129/todos.xml");

}

Page 38: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

RestAssured as an HTTP Library

—RestAssured wraps the Java HTTP libraries and uses Groovy to create a DSL.

We can use it to automate any HTTP service. We don't need all the Given, When, Then, etc. and Assertions.

Page 39: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

This is RestAssured Misused as an HTTP library

@Test public void aUserCanAuthenticateAndUseAPIWithBasicAuth(){

HttpMessageSender http = new HttpMessageSender( TestEnvDefaults.getURL());

http.basicAuth( TestEnvDefaults.getAdminUserName(), TestEnvDefaults.getAdminUserPassword());

Response response = http.getResponseFrom( TracksApiEndPoints.todos);

Assert.assertEquals(200, response.getStatusCode());

}

Page 40: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

BeliefsStrong beliefs are important when you are doing something.

Can you detach from the belief when not doing something?

Page 41: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

About Selenium

Model:

—Selenium is not a test tool.

Reality:—Selenium automates Browsers.—Testers want to automate browsers.—When testers use Selenium to Automate

Browsers, they use Selenium as a Test Tool

Page 42: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

About Web Browsers

—For some people it 'is' the internet.—Browsers are for everyone (not just testers)—Browsers have 'dev tools' (not test tools)

We use Browsers as test tools.

Page 43: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

What is a Web Browser?

—an HTML reader and renderer?—a JavaScript interpreter?—an HTTP based URI and response processor?—an async and multi-threaded HTTP based URI and

response processor?—What else?

Page 44: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Our model changes our process

Each understanding of what it 'is', and what it 'does', changes the risk profile.

The more models we have, the more things we can test, and more ways we have to justify our testing.

Page 45: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Features - what it says it does

What it actually does when it does what it says it does

Page 46: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

JUnit is a unit testing tool

Page 47: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

JUnit is a unit testing tool

Except when we use it as a runner for code which will automate anything we want. Then we can use it as a GUI or a command line interface.

Page 48: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Other Examples?

Page 49: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

What is it?

—Go beyond 'social' abstractions—What does it say it does?—What else does it do?—What does it actually do?—How does it do that?—How can you use that as part of your testing?—How does that limit you?

Page 50: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

We Test By Exploring the System's

—1) events and behaviours—2) explanations—3) social controls

Page 51: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Finally: have fun and increase productivity when you automate by misusing tools

Use their:—1) events and behaviours

Build our own:

—2) explanations

Ignore other peoples':

—3) social controls

Page 52: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Learn to be Evil

—www.eviltester.com—@eviltester—www.youtube.com/user/EviltesterVideos

Page 53: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Learn to Use Tools

—www.seleniumsimplified.com—www.javafortesters.com

Page 54: Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing, fun and productivity" slides

Learn About Alan Richardson

—www.compendiumdev.co.uk—uk.linkedin.com/in/eviltester