SlideShare ist ein Scribd-Unternehmen logo
1 von 67
Downloaden Sie, um offline zu lesen
If you want to
automate, you learn
to code
- and you learn to code well
Fast paced summary of what we
are going to cover
insert fast paced summary here :)
Alan Richardson
• www.javafortesters.com
• www.seleniumsimplified.com
• www.eviltester.com
• www.compendiumdev.co.uk
• uk.linkedin.com/in/eviltester
• @eviltester
"Automate" doesn't mean
"Automate Testing"
• dictionary.com/browse/automate
"to install automatic procedures, as for
manufacturing or servicing;"
You don't need to
'code' to 'automate'
We can Automate by adding tools
I use Tools
- FTP
- Text Editors
- etc.
We take 'tools' for
granted
Because we use them so often
So its worth investigating:
• what tools are you using?
• capabilities of your current tools
• alternatives to your current tools
There are some
processes we have to
automate
And someone else might have
automated them already.
That's a tool.
But tools come with
limitations
Requisite Variety
"Only variety can destroy variety" - Ross
Ashby
en.wikipedia.org/wiki/Variety_(cybernetics))
"Only variety can absorb variety" -
Stafford Beer
Strategy #1 - Build a
toolbox with Multiple
Tools
There is a difference
between 'Strategic'
and 'Tactical'
Automate Tactically
solve a problem quickly
Automate
Strategically
solve a problem for the long term
Toolbox building is
'Strategic'
A long term strategy to identify
tools.
And I have to commit to this.
Strategies change and
evolve
Strategic Vs Tactical
Finding Tools can be a
Tactical pursuit
If I learn how to find tools.
I can find tools when I need them.
Finding Tools when
you need them
Is also a key step in learning how
to automate.
How do we find tools?
• What are you trying to achieve?
• learn the domain language for the task
• Narrow by technology?
• technology used
• technology tool implemented in
Non-domain specific
task
Search: "I want to copy a
document to another machine"
learn: server, transfer, file
Domain language for
task
Search: "Tool to transfer file to
server"
learn: ftp, scp, sftp, ssh protocol,
login, user account
Specific Technology
"What does my specific server use?"
"What do I use?"
Search: "Windows Software to
transfer file via scp ssh key"
Building these queries and
chaining them is a skill
• the more we learn the better we get
• the better we understand the technology, the faster we find
what we need
• technical staff take this skill for granted
• we also use this skill to find - IDE, Libraries, Build Tools, etc.
Extend tools
Assuming that you can find tools
Favour tools that support extension
Learn the Extension possibilities for your chosen tools
Scripting a tool is an
easy way to learn to
code
Tool Chaining
Don't under estimate the power
of the command line
On Windows and Linux
And now for the meat
of of it
"Give a man a fish you feed him
for a day.
Teach a man to fish then you feed
him for a lifetime."
The Ultimate Aim
"Give humankind the power to
summon forth fish from the
empty air"
Learn to code and
write our own
When people learn to
code they focus on
programming language
IDEs
build process
'making programs'
We don't always
'make programs'
when we automate
Pick your
programming
language for the right
reasons
'Easy to learn'?
'Easy to run code'?
'Easy to cobble together stuff that
runs from copy and pasted
examples off the internet'?
How to make Java
Easy to run
Write an @Test method that does
stuff
Run the @Test method
Tadah!
So how do we pick a language?
• what is your system written in?
• what languages do people that you can ask for help know
how to code?
• what examples have you found that do what you want to
do?
• what tutorials or books have you found that you like?
Automating Tactically
Vs Automating
Strategically
"Test Automation" - Automating
Strategically
• long term
• paths through system
Automate Tactically
• Automate to save time
• Automate to make your process more repeatable
• Automate to help you, or someone else
Tactical Solutions Might Become
Strategic
• Maintainable
• Abstraction Layers
• Tested
Strategic Solutions can be used
Tactically
• Adhoc exploration using abstraction layers
• Temporary Data Exploration
Automate Tactically With
• Tools
• Chaining of Tools
• Scripting languages using tools and libraries
• @Test method using libraries
Warning - Tactical Solutions might
not translate to Strategic
Solutions without work
• the tactics we choose might not scale
• unreliable interaction
• time based synchronisation
• hacky code
Danger - Opportunity Cost
• Some people view "Testing" as an opportunity cost of
increased strategic "Automating"
• We could also consider "Not improving your ability to
automate" an Opportunity cost of not automating
strategically
We can refactor
tactical solutions into
strategic solutions
if we chose appropriate
technology
Examples of moving from tactical
to strategic
Can't 'show you' many because:
• a lot of this is commercially sensitive
• very domain and project specific
How do I tend to build tactical
solutions?
I can tell you that:
• I tend to use Java, not a scripting language
• Because... libraries, maven, JUnit
• ... I know it well
And now an Example
Pandocifier
Automate Tactically
• batch shell scripts to automate pandoc
• pandocifier to run leanpub through pandoc
Refactor to Strategically Automated
• review, plan, refactor
• keep it working as a tactical automated solution
Review Pandocifier
• Refactor to domain objects
• Execute Pandoc
• Inject Configuration
• Externalise Configuration
• External Pandocifier Object
• Build into app
Refactor to domain objects
• There is one domain object - BookTxtFile
• If I refactor to domain objects
• fewer comments in the code
• fewer lines of code in tactical solution
• e.g. PreviewMdFile, BookDetailsContentReader
• write Unit tests for the domain objects
Execute Pandoc
Instead of writing out instructions to the user to execute
'tactic'.
// output the command to generate the book to console
System.out.println(
"pandoc leanpubpreview.md -f markdown -s " +
"-o leanpubpreview.pdf --toc");
The code could execute them:
Process p = Runtime.getRuntime().exec
("pandoc leanpubpreview.md -f markdown -s " +
"-o leanpubpreview.pdf --toc")
Inject Configuration
Instead of hardcoding paths and file names (possibly pandoc
arguments)
I could create a PandocifierConfig object with
getInputFilePath() and getOutputFileName()
Externalise Configuration
Mechanism to create the PandocifierConfig from a file
• Properties file - easy to read with standard Java
• text file - write a parser
• JSON file - need an external library
External Pandocifier Object
• could create Pandocifier from @Test injecting config
• new Pandocifier(config).createPDF()
Build into app
• create a main method with params that setup config
• use mvn package to create a .jar file
• use java -jar pandocifier.jar to execute
• add to path and run from anywhere
Prioritise the 'ideas' to maximise
tactical advantage
• Refactor, Execute, ...
• Inject Config, Execute Pandoc, ...
• Externalise Configuration, Execute Pandoc ...
Decide Prioritisation
• Inject Config,
• Execute Pandoc,
• Pandocifier,
• External Config
find the code to support this decision on github
Walkthrough of Changes for
Config
• Create object to model config - store, not transfrom
• I Know that 'if' I create a main later, I can still use this
• Move the 'hard coded' stuff into an object
• Add it to an @Before to 'simulate' injection
• Possible future need for a PanDoc configuration
see LeanPubConfigTest.java
Walkthrough of Changes for
Execute
• Initially Runtime.getRuntime().exec("...").
• Execution errors
• Rather than debug it I moved to ProcessBuilder
• New config for the setPandocPath
• Added opened output folder - new automated time saver
see LeanPubPandocConfigExecuteTest.java
Walkthrough of Changes for
Pandocifier Object
• I create an internal class called Pandocifier
• construct it in the @Before with the config
• amend the @Test to use a Pandocifier createPDF
• automatically create the createPDF
• copy paste the @Test code into createPDF
see LeanPubPandocConfigExecuteObjectTest.java
Walkthrough of Changes for
External Config
• Use new @Ignore @Test to create a property file
• Create a property file reader that returns a config as an
internal class
• Now the createPreviewMVP @Test method looks like a main
method
see LeanPubPandocConfigExecuteObjectPropertiesTest.java
Make it an App
• create a main method, call from @Ignore MVP @Test
• move the inner classes out to main packages
• change the pom.xml to have a build section for the mainfest
• delete previous 'refactoring tests'
• mvn package
• because it is being released on github removed the
'leanpub' from .jar so people don't think it is official
Retrospective
• always kept the tactical mvp class running and available
• refactored to strategic solution
• inner classes until used by multiple classes e.g. main and
MVP
• final strategic solution 'wrapped' as a 'tactical' @Ignored test
• didn't add many new features, didn't 'test', still a lot to do if
'other' people want to use it
• but now I can add it into CI for my local builds
Final Thoughts
• Automate tactically vs automate strategically
• Use of Tools
• Learn to program by extending tools
• How to choose a programming language
• How to move from tactical to strategic
Learn to code well
• still lots to learn, but its fun
• Abstractions
• Domain Driven Design
• Test Driven Development
• Design Patterns
Whatever you do. Make it add value.
Alan Richardson
• www.javafortesters.com
• www.seleniumsimplified.com
• www.eviltester.com
• www.compendiumdev.co.uk
• uk.linkedin.com/in/eviltester
• @eviltester

Weitere ähnliche Inhalte

Was ist angesagt?

Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...
Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...
Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...
Alan Richardson
 

Was ist angesagt? (20)

Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014
 
Automating to Augment Testing
Automating to Augment TestingAutomating to Augment Testing
Automating to Augment Testing
 
Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ...
Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ...Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ...
Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ...
 
Evil testers guide to technical testing
Evil testers guide to technical testingEvil testers guide to technical testing
Evil testers guide to technical testing
 
Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...
Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...
Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...
 
Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021
 
Technology Based Testing
Technology Based TestingTechnology Based Testing
Technology Based Testing
 
Secrets and Mysteries of Automated Execution Keynote slides
Secrets and Mysteries of Automated Execution Keynote slidesSecrets and Mysteries of Automated Execution Keynote slides
Secrets and Mysteries of Automated Execution Keynote slides
 
Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020
 
Automating Strategically or Tactically when Testing
Automating Strategically or Tactically when TestingAutomating Strategically or Tactically when Testing
Automating Strategically or Tactically when Testing
 
The Evil Tester's Guide to HTTP proxies Tutorial
The Evil Tester's Guide to HTTP proxies TutorialThe Evil Tester's Guide to HTTP proxies Tutorial
The Evil Tester's Guide to HTTP proxies Tutorial
 
Effective Software Testing for Modern Software Development
Effective Software Testing for Modern Software DevelopmentEffective Software Testing for Modern Software Development
Effective Software Testing for Modern Software Development
 
Push Functional Testing Further
Push Functional Testing FurtherPush Functional Testing Further
Push Functional Testing Further
 
Joy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan RichardsonJoy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan Richardson
 
How To Test With Agility
How To Test With AgilityHow To Test With Agility
How To Test With Agility
 
Odinstar 2017 - Real World Automating to Support Testing
Odinstar 2017 - Real World Automating to Support TestingOdinstar 2017 - Real World Automating to Support Testing
Odinstar 2017 - Real World Automating to Support Testing
 
Technical and Testing Challenges: Using the "Protect The Square" Game
Technical and Testing Challenges: Using the "Protect The Square" GameTechnical and Testing Challenges: Using the "Protect The Square" Game
Technical and Testing Challenges: Using the "Protect The Square" Game
 
Your Automated Execution Does Not Have to be Flaky
Your Automated Execution Does Not Have to be FlakyYour Automated Execution Does Not Have to be Flaky
Your Automated Execution Does Not Have to be Flaky
 
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
 
Agile Testing Days 2014 Keynote - Helping Testers Add Value on Agile Projects
Agile Testing Days 2014 Keynote - Helping Testers Add Value on Agile ProjectsAgile Testing Days 2014 Keynote - Helping Testers Add Value on Agile Projects
Agile Testing Days 2014 Keynote - Helping Testers Add Value on Agile Projects
 

Ähnlich wie If you want to automate, you learn to code

Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
Einar Ingebrigtsen
 
Continuous Integration In A PHP World
Continuous Integration In A PHP WorldContinuous Integration In A PHP World
Continuous Integration In A PHP World
Idaf_1er
 

Ähnlich wie If you want to automate, you learn to code (20)

Continuous feature-development
Continuous feature-developmentContinuous feature-development
Continuous feature-development
 
Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1
 
Enterprise PHP
Enterprise PHPEnterprise PHP
Enterprise PHP
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Node.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.jsNode.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.js
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austinDev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
Dev ops ci-ap-is-oh-my_security-gone-agile_ut-austin
 
Testing mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP frameworkTesting mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP framework
 
Kku2011
Kku2011Kku2011
Kku2011
 
Learning to code
Learning to codeLearning to code
Learning to code
 
Transferring Software Testing Tools to Practice
Transferring Software Testing Tools to PracticeTransferring Software Testing Tools to Practice
Transferring Software Testing Tools to Practice
 
Continuous Integration In A PHP World
Continuous Integration In A PHP WorldContinuous Integration In A PHP World
Continuous Integration In A PHP World
 
Jason Kent - AppSec Without Additional Tools
Jason Kent - AppSec Without Additional ToolsJason Kent - AppSec Without Additional Tools
Jason Kent - AppSec Without Additional Tools
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
Making security-agile matt-tesauro
Making security-agile matt-tesauroMaking security-agile matt-tesauro
Making security-agile matt-tesauro
 
KrishnaToolComparisionPPT.pdf
KrishnaToolComparisionPPT.pdfKrishnaToolComparisionPPT.pdf
KrishnaToolComparisionPPT.pdf
 
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
TDD - Seriously, try it! - Trójmiasto Java User Group (17th May '23)
 
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
TDD - Seriously, try it! - Trjjmiasto JUG (17th May '23)
 
TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)TDD - Seriously, try it! (updated '22)
TDD - Seriously, try it! (updated '22)
 

Mehr von Alan Richardson

FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
FAQ - why does my code throw a null pointer exception - common reason #1 Rede...FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
Alan Richardson
 

Mehr von Alan Richardson (17)

Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009
 
The Future of Testing Webinar
The Future of Testing WebinarThe Future of Testing Webinar
The Future of Testing Webinar
 
Programming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStringsProgramming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStrings
 
About Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil TesterAbout Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil Tester
 
Shift left-testing
Shift left-testingShift left-testing
Shift left-testing
 
Automating and Testing a REST API
Automating and Testing a REST APIAutomating and Testing a REST API
Automating and Testing a REST API
 
TDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzzTDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzz
 
What is Testability vs Automatability? How to improve your Software Testing.
What is Testability vs Automatability? How to improve your Software Testing.What is Testability vs Automatability? How to improve your Software Testing.
What is Testability vs Automatability? How to improve your Software Testing.
 
What is Agile Testing? A MindMap
What is Agile Testing? A MindMapWhat is Agile Testing? A MindMap
What is Agile Testing? A MindMap
 
Evil Tester's Guide to Agile Testing
Evil Tester's Guide to Agile TestingEvil Tester's Guide to Agile Testing
Evil Tester's Guide to Agile Testing
 
The Evil Tester Show - Episode 001 Halloween 2017
The Evil Tester Show - Episode 001 Halloween 2017The Evil Tester Show - Episode 001 Halloween 2017
The Evil Tester Show - Episode 001 Halloween 2017
 
What is Regression Testing?
What is Regression Testing?What is Regression Testing?
What is Regression Testing?
 
Simple ways to add and work with a `.jar` file in your local maven setup
Simple ways to add and work with a `.jar` file in your local maven setupSimple ways to add and work with a `.jar` file in your local maven setup
Simple ways to add and work with a `.jar` file in your local maven setup
 
Re-thinking Test Automation and Test Process Modelling (in pictures)
Re-thinking Test Automation and Test Process Modelling (in pictures)Re-thinking Test Automation and Test Process Modelling (in pictures)
Re-thinking Test Automation and Test Process Modelling (in pictures)
 
Learning in Public - A How to Speak in Public Workshop
Learning in Public - A How to Speak in Public WorkshopLearning in Public - A How to Speak in Public Workshop
Learning in Public - A How to Speak in Public Workshop
 
How to Practise to Remove Fear of Public Speaking
How to Practise to Remove Fear of Public SpeakingHow to Practise to Remove Fear of Public Speaking
How to Practise to Remove Fear of Public Speaking
 
FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
FAQ - why does my code throw a null pointer exception - common reason #1 Rede...FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Kürzlich hochgeladen (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

If you want to automate, you learn to code

  • 1. If you want to automate, you learn to code - and you learn to code well
  • 2. Fast paced summary of what we are going to cover insert fast paced summary here :)
  • 3. Alan Richardson • www.javafortesters.com • www.seleniumsimplified.com • www.eviltester.com • www.compendiumdev.co.uk • uk.linkedin.com/in/eviltester • @eviltester
  • 4. "Automate" doesn't mean "Automate Testing" • dictionary.com/browse/automate "to install automatic procedures, as for manufacturing or servicing;"
  • 5. You don't need to 'code' to 'automate' We can Automate by adding tools
  • 6. I use Tools - FTP - Text Editors - etc.
  • 7. We take 'tools' for granted Because we use them so often
  • 8. So its worth investigating: • what tools are you using? • capabilities of your current tools • alternatives to your current tools
  • 9. There are some processes we have to automate And someone else might have automated them already. That's a tool.
  • 10. But tools come with limitations
  • 11. Requisite Variety "Only variety can destroy variety" - Ross Ashby en.wikipedia.org/wiki/Variety_(cybernetics)) "Only variety can absorb variety" - Stafford Beer
  • 12. Strategy #1 - Build a toolbox with Multiple Tools
  • 13. There is a difference between 'Strategic' and 'Tactical'
  • 14. Automate Tactically solve a problem quickly Automate Strategically solve a problem for the long term
  • 15. Toolbox building is 'Strategic' A long term strategy to identify tools. And I have to commit to this.
  • 18. Finding Tools can be a Tactical pursuit If I learn how to find tools. I can find tools when I need them.
  • 19. Finding Tools when you need them Is also a key step in learning how to automate.
  • 20. How do we find tools? • What are you trying to achieve? • learn the domain language for the task • Narrow by technology? • technology used • technology tool implemented in
  • 21. Non-domain specific task Search: "I want to copy a document to another machine" learn: server, transfer, file
  • 22. Domain language for task Search: "Tool to transfer file to server" learn: ftp, scp, sftp, ssh protocol, login, user account
  • 23. Specific Technology "What does my specific server use?" "What do I use?" Search: "Windows Software to transfer file via scp ssh key"
  • 24. Building these queries and chaining them is a skill • the more we learn the better we get • the better we understand the technology, the faster we find what we need • technical staff take this skill for granted • we also use this skill to find - IDE, Libraries, Build Tools, etc.
  • 25. Extend tools Assuming that you can find tools Favour tools that support extension Learn the Extension possibilities for your chosen tools
  • 26. Scripting a tool is an easy way to learn to code
  • 27. Tool Chaining Don't under estimate the power of the command line On Windows and Linux
  • 28. And now for the meat of of it "Give a man a fish you feed him for a day. Teach a man to fish then you feed him for a lifetime."
  • 29. The Ultimate Aim "Give humankind the power to summon forth fish from the empty air"
  • 30. Learn to code and write our own
  • 31. When people learn to code they focus on programming language IDEs build process 'making programs'
  • 32. We don't always 'make programs' when we automate
  • 34. 'Easy to learn'? 'Easy to run code'? 'Easy to cobble together stuff that runs from copy and pasted examples off the internet'?
  • 35. How to make Java Easy to run Write an @Test method that does stuff Run the @Test method Tadah!
  • 36. So how do we pick a language? • what is your system written in? • what languages do people that you can ask for help know how to code? • what examples have you found that do what you want to do? • what tutorials or books have you found that you like?
  • 38. "Test Automation" - Automating Strategically • long term • paths through system
  • 39. Automate Tactically • Automate to save time • Automate to make your process more repeatable • Automate to help you, or someone else
  • 40. Tactical Solutions Might Become Strategic • Maintainable • Abstraction Layers • Tested
  • 41. Strategic Solutions can be used Tactically • Adhoc exploration using abstraction layers • Temporary Data Exploration
  • 42. Automate Tactically With • Tools • Chaining of Tools • Scripting languages using tools and libraries • @Test method using libraries
  • 43. Warning - Tactical Solutions might not translate to Strategic Solutions without work • the tactics we choose might not scale • unreliable interaction • time based synchronisation • hacky code
  • 44. Danger - Opportunity Cost • Some people view "Testing" as an opportunity cost of increased strategic "Automating" • We could also consider "Not improving your ability to automate" an Opportunity cost of not automating strategically
  • 45. We can refactor tactical solutions into strategic solutions if we chose appropriate technology
  • 46. Examples of moving from tactical to strategic Can't 'show you' many because: • a lot of this is commercially sensitive • very domain and project specific
  • 47. How do I tend to build tactical solutions? I can tell you that: • I tend to use Java, not a scripting language • Because... libraries, maven, JUnit • ... I know it well
  • 48. And now an Example Pandocifier
  • 49. Automate Tactically • batch shell scripts to automate pandoc • pandocifier to run leanpub through pandoc Refactor to Strategically Automated • review, plan, refactor • keep it working as a tactical automated solution
  • 50. Review Pandocifier • Refactor to domain objects • Execute Pandoc • Inject Configuration • Externalise Configuration • External Pandocifier Object • Build into app
  • 51. Refactor to domain objects • There is one domain object - BookTxtFile • If I refactor to domain objects • fewer comments in the code • fewer lines of code in tactical solution • e.g. PreviewMdFile, BookDetailsContentReader • write Unit tests for the domain objects
  • 52. Execute Pandoc Instead of writing out instructions to the user to execute 'tactic'. // output the command to generate the book to console System.out.println( "pandoc leanpubpreview.md -f markdown -s " + "-o leanpubpreview.pdf --toc"); The code could execute them: Process p = Runtime.getRuntime().exec ("pandoc leanpubpreview.md -f markdown -s " + "-o leanpubpreview.pdf --toc")
  • 53. Inject Configuration Instead of hardcoding paths and file names (possibly pandoc arguments) I could create a PandocifierConfig object with getInputFilePath() and getOutputFileName()
  • 54. Externalise Configuration Mechanism to create the PandocifierConfig from a file • Properties file - easy to read with standard Java • text file - write a parser • JSON file - need an external library
  • 55. External Pandocifier Object • could create Pandocifier from @Test injecting config • new Pandocifier(config).createPDF()
  • 56. Build into app • create a main method with params that setup config • use mvn package to create a .jar file • use java -jar pandocifier.jar to execute • add to path and run from anywhere
  • 57. Prioritise the 'ideas' to maximise tactical advantage • Refactor, Execute, ... • Inject Config, Execute Pandoc, ... • Externalise Configuration, Execute Pandoc ...
  • 58. Decide Prioritisation • Inject Config, • Execute Pandoc, • Pandocifier, • External Config find the code to support this decision on github
  • 59. Walkthrough of Changes for Config • Create object to model config - store, not transfrom • I Know that 'if' I create a main later, I can still use this • Move the 'hard coded' stuff into an object • Add it to an @Before to 'simulate' injection • Possible future need for a PanDoc configuration see LeanPubConfigTest.java
  • 60. Walkthrough of Changes for Execute • Initially Runtime.getRuntime().exec("..."). • Execution errors • Rather than debug it I moved to ProcessBuilder • New config for the setPandocPath • Added opened output folder - new automated time saver see LeanPubPandocConfigExecuteTest.java
  • 61. Walkthrough of Changes for Pandocifier Object • I create an internal class called Pandocifier • construct it in the @Before with the config • amend the @Test to use a Pandocifier createPDF • automatically create the createPDF • copy paste the @Test code into createPDF see LeanPubPandocConfigExecuteObjectTest.java
  • 62. Walkthrough of Changes for External Config • Use new @Ignore @Test to create a property file • Create a property file reader that returns a config as an internal class • Now the createPreviewMVP @Test method looks like a main method see LeanPubPandocConfigExecuteObjectPropertiesTest.java
  • 63. Make it an App • create a main method, call from @Ignore MVP @Test • move the inner classes out to main packages • change the pom.xml to have a build section for the mainfest • delete previous 'refactoring tests' • mvn package • because it is being released on github removed the 'leanpub' from .jar so people don't think it is official
  • 64. Retrospective • always kept the tactical mvp class running and available • refactored to strategic solution • inner classes until used by multiple classes e.g. main and MVP • final strategic solution 'wrapped' as a 'tactical' @Ignored test • didn't add many new features, didn't 'test', still a lot to do if 'other' people want to use it • but now I can add it into CI for my local builds
  • 65. Final Thoughts • Automate tactically vs automate strategically • Use of Tools • Learn to program by extending tools • How to choose a programming language • How to move from tactical to strategic
  • 66. Learn to code well • still lots to learn, but its fun • Abstractions • Domain Driven Design • Test Driven Development • Design Patterns Whatever you do. Make it add value.
  • 67. Alan Richardson • www.javafortesters.com • www.seleniumsimplified.com • www.eviltester.com • www.compendiumdev.co.uk • uk.linkedin.com/in/eviltester • @eviltester