SlideShare une entreprise Scribd logo
1  sur  55
Télécharger pour lire hors ligne
AUTOMATED
ACCEPTANCE TESTING
GOOD PRACTICES AND PITFALLS
Wyn Van Devanter
wyn.vandevanter@excella.com
@wynv
Part I
AAT Overview
Automated Acceptance Tests (AATs)
Given – When – Then
Given I have no food
When I buy 2 pickles on
Amazon
Then I have some food
End-to-end UI, Integration tests
Acceptance
Component
Unit
Black box
White box
End-to-end
Business facing
Localized
Technology
facing
Manual Checking
End-to-end
UI
Component
Unit
SOURCE: http://blogs.agilefaqs.com/2011/02/01/inverting-the-testing-pyramid
Manual
Checking
Inverting the Testing Pyramid
UI
Acceptance,
Integration
Unit
-Exploratory testing
Acceptance Test Strategy
• Happy paths
• Major unhappy paths
• Legacy
• Regression
Minimize # of end-to-end tests
• AATs should be a small portion of your test suite
• Is your new feature entirely new?
• Balance high # of unit tests + selected end-to-end &
acceptance
Create them for journeys, not stories
• Too heavy, slow and expensive to create for each story
• Must be tracked outside of stories
Who writes acceptance tests?
Those closest to the work should
inplement the tests
• More efficient
• Most correct
A framework is key
• Code reuse
• Rapid development
• Readable tests
• More maintainable tests
Don’t go through the UI
• Controller down, service down
• Use mocks, stubs
What can you write them in?
Vim
Part II
How they work
Start with a story
User story
As an internet user,
I want to search for “ALT.NET”
And get valid results
• Acceptance criteria 1: I get at least 100k results
• Acceptance criteria 2: Results ordered by relevance
…
Scenarios
Feature
Tracking AATs
Tracking AATs
Various Frameworks
Browser driver
Browser automation
Test runner/harness
BDD Framework
.NET
Selenium,
Phantom.js
Selenium,
Waitn
NUnit, xUnit,
MSTest
SpecFlow,
Fitness (.NET
runner),
Cuke4Nuke,
MSpec
JavaScript
Selemium,
Phantom.js
Phantom.js/Casp
er.js
Mocha, Jasmine
Chai, Jasmine
Java/Ruby
Selenium,
Phantom.js
Selenium,
Waitr
JUnit, test-unit
JBehave, Fitness,
Cucumber/RSpec/
Capybara
Why Have AATs? (Pros)
Communication
• Helps specify behavior of the system in plain text
• Provides a medium for non-tech and devs to agree on
Are we
talking
about
the right
system?
Seams, unit test mistakes
Automation
“There’s no place for
human beings to be
doing regression testing
manually.”
-Jez Humble
Speedier deployments
Save resources
More testing during development
Why NOT Have AATs?
Why don’t more people use them?
Impediments
• Poor adoption
• Bandwidth/Velocity
• Learning Curve/Experience
• Business users won’t write specifications
Why NOT have AATs?
• Maintenance
• Speed
• High false negatives, non-determinism
Questions?
Part IV
Overcoming the
Impediments
Use a headless browser
When Acceptances Tests catches a bug
• See why bug got through unit/integration tests
• Add unit, integration tests
• Prune AAT?
Unit
Concise Specs
• Declarative
• Reuse steps
• Concise, many methods, fat fixtures
Bad:
• Click on Log In button
• Click username box and type ‘myUsername’ and click ‘password’ box and type
‘myPassword’
• Click on link for Transfer Payment
• Click box for amount and type 400
• Click ‘Transfer’ button
• Assert success message
Good:
• Login as ‘MyAccountName’
• Navigate to Transfer Payment page
• Transfer 400 dollars
• Assert success message
Organize your tests…
Use Page Objects
Keeps each page’s tests
• Encapsulated
• Readable
• Reusable
public class GoogleHomepage: PageBase, IGoogleHomepage {
// Flow for this page
}
Domain
Service
UI
GoogleHomepage
+search(query)
+clickSearch()
+clickGettingLucky Data Access
GoogleHomepageService
+search(query)
+clickSearch()
+clickGettingLucky
IGoogleHomepage
+search(query)
+clickSearch()
+clickGettingLucky
Page
Objects
Page Objects
Faster test creation – like Legos
• Keeps step definitions very readable and thin
Hides details
• Abstracts SpecFlow from Selenium
• Keeps infrastructure at a lower level
Keeps changes minimal
• Changes in the application should require minimal
changes in the tests, and not in the specs
Easier to write new tests
• Constructing page objects
• Can be used to create a DSL
One way
[When(@"I log in with the teacher account '(.*)'")]
public void WhenILogInWithTheTeacherAccount(string orgCode)
{
var driver = new FirefixDriver();
driver.Navigate().GoToUrl("http://www.google.com");
var userTb = Driver.FindElement(By.Name("username”));
var passwordTb = Driver.FindElement(By.Id("password"));
userTb.SendKeys(username);
passwordTb.SendKeys(password);
var loggedInLink = Driver.FindElement(By.LinkText("Log Out"));
Assert.That(loggedInLink != null);
}
Better way – page objects
public class LogInPage : PageBase
{
public PageBase LogIn(string username, string password)
{
Driver.FindElement(By.Id("UserName")).SendKeys(username);
Driver.FindElement(By.Id("Password")).SendKeys(password);
Driver.FindElement(By.CssSelector("input[type="submit"]")).Click();
return GetInstance<AccountLandingPage>(Driver);
}
public void HasExpectedTab(string tabName)
{
var link = Driver.FindElement(By.LinkText(tabName));
Assert.AreEqual(tabName, link.Text);
}
}
Other things
• Managed test data
• Distributed execution
Tips
Developer tips
• Don't run in same assembly as other tests, so these can
be run separately since they're very slow (i.e. nightly)
• Navigation
• Create different levels of suites depending on depth/level
of feedback desired:
• Smoke, Current iteration/sprint, Regression
• Run AATs as close to the real environment as possible
Gherkin
Specs shouldn’t have much setup code
Given I am on the homepage
And I click login
And I enter username of ‘username’ and password of ‘password’
When clicking ‘Log In’
Then take me to my landing page
Given I am on the homepage
When logging in with ‘username’ and ‘password’
Then take me to my landing page
UI tests
• Sometimes tests will fail if the page doesn’t have enough
time to load
• Capture screen shots when tests fail
• Run nightly
• Run across multiple machines
Anti-patterns
• Developers writing acceptance tests by themselves, for
themselves
• Tying AATs to an implementation - unit tests are
implementation specific, AATs are NOT
• Too much repetition in the gherkin
• Too many UI tests
• UI tests are failing too easily when changing the UI
Conclusion
Where we can be
• Reliable tests
• Reusable test code (even a DSL)
• Separation of concerns
• Short and clear tests
• Fast test creation
• Quick regression feedback
• Tests that are understood by non-technical people
• Fewer bugs
Resources:
Tools used here:
• SpecFlow – specflow.org
• PhantomJS – phantomjs.org
• Selenium WebDriver – seleniumhq.org
Books:
• Specification By Example, Gojko Adzic
• Continuous Delivery, Jez Humble, David Farley
• Growing Object-Oriented Software, Guided By Tests, Steve Freeman, Nat Pryce
Articles:
• Automated Acceptance Tests, http://www.thoughtworks.com/insights/articles/automated-acceptance-tests
• BDD with SpecFlow and ASP.NET MVC, http://blog.stevensanderson.com/2010/03/03/behavior-driven-
development-bdd-with-specflow-and-aspnet-mvc/
• Using Gherkin Language in SpecFlow,
https://github.com/techtalk/SpecFlow/wiki/Using-Gherkin-Language-in-SpecFlow
• BDD with SpecFlow, MSDN, http://msdn.microsoft.com/en-us/magazine/gg490346.aspx
• Using SpecFlow with the Page Object, http://blogs.lessthandot.com/index.php/EnterpriseDev/application-lifecycle-
management/using-specflow-to
• Problems with Acceptance Tests, http://xprogramming.com/xpmag/problems-with-acceptance-testing
• Top 10 reasons why teams fail with Acceptance Testing, http://gojko.net/2009/09/24/top-10-reasons-why-teams-
fail-with-acceptance-testing/
• Maintaining Automated Acceptance Tests (ThoughtWorks), http://www.youtube.com/watch?v=uf0EVbH5hdA
• Creating Maintainable Automated Acceptance Test Suites, Jez Humble,
• http://www.youtube.com/watch?v=v-L_2y6g5DI
Happy Three Amigos
Slides: http://www.slideshare.net/wynvandevanter/automated-acceptance-
tests-in-net
Code:
https://github.com/Wyntuition/AATsInSpecFlowDemos
wyn.vandevanter@excella.com
@wynv

Contenu connexe

Tendances

Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Steven Smith
 
Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Steven Smith
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
How to scale your Test Automation
How to scale your Test AutomationHow to scale your Test Automation
How to scale your Test AutomationKlaus Salchner
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with SeleniumDave Haeffner
 
Selenium Deep Dive
Selenium Deep DiveSelenium Deep Dive
Selenium Deep DiveAnand Bagmar
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing SoftwareSteven Smith
 
Breaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingBreaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingSteven Smith
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing SoftwareSteven Smith
 
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin DevelopmentAtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Developmentmrdon
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Measuring Coverage From E2E Tests
Measuring Coverage From E2E TestsMeasuring Coverage From E2E Tests
Measuring Coverage From E2E TestsAnand Bagmar
 
Next Generation Functional & Visual Testing powered by AI
Next Generation Functional & Visual Testing powered by AINext Generation Functional & Visual Testing powered by AI
Next Generation Functional & Visual Testing powered by AIAnand Bagmar
 
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020Visual Validation - The missing tip of the automation pyramid @AgileIndia2020
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020Anand Bagmar
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsSteve Malsam
 
Design patterns in test automation
Design patterns in test automationDesign patterns in test automation
Design patterns in test automationMikalai Alimenkou
 
How to Un-Flake Flaky Tests - A New Hire's Toolkit
How to Un-Flake Flaky Tests - A New Hire's ToolkitHow to Un-Flake Flaky Tests - A New Hire's Toolkit
How to Un-Flake Flaky Tests - A New Hire's ToolkitZachary Attas
 

Tendances (20)

Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016
 
Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016Improving the Quality of Existing Software - DevIntersection April 2016
Improving the Quality of Existing Software - DevIntersection April 2016
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
How to scale your Test Automation
How to scale your Test AutomationHow to scale your Test Automation
How to scale your Test Automation
 
Getting Started with Selenium
Getting Started with SeleniumGetting Started with Selenium
Getting Started with Selenium
 
Selenium Deep Dive
Selenium Deep DiveSelenium Deep Dive
Selenium Deep Dive
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
 
Breaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingBreaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit Testing
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
 
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin DevelopmentAtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
 
BDD in Automation Testing
BDD in Automation TestingBDD in Automation Testing
BDD in Automation Testing
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
QAorHighway2016
QAorHighway2016QAorHighway2016
QAorHighway2016
 
Measuring Coverage From E2E Tests
Measuring Coverage From E2E TestsMeasuring Coverage From E2E Tests
Measuring Coverage From E2E Tests
 
Next Generation Functional & Visual Testing powered by AI
Next Generation Functional & Visual Testing powered by AINext Generation Functional & Visual Testing powered by AI
Next Generation Functional & Visual Testing powered by AI
 
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020Visual Validation - The missing tip of the automation pyramid @AgileIndia2020
Visual Validation - The missing tip of the automation pyramid @AgileIndia2020
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot Overlords
 
React a11y-csun
React a11y-csunReact a11y-csun
React a11y-csun
 
Design patterns in test automation
Design patterns in test automationDesign patterns in test automation
Design patterns in test automation
 
How to Un-Flake Flaky Tests - A New Hire's Toolkit
How to Un-Flake Flaky Tests - A New Hire's ToolkitHow to Un-Flake Flaky Tests - A New Hire's Toolkit
How to Un-Flake Flaky Tests - A New Hire's Toolkit
 

Similaire à Automated Acceptance Test Practices and Pitfalls

Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerAndrew Siemer
 
5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated Testing5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated TestingBhupesh Dahal
 
Test automation engineer
Test automation engineerTest automation engineer
Test automation engineerSadaaki Emura
 
Test automation lesson
Test automation lessonTest automation lesson
Test automation lessonSadaaki Emura
 
Karishma Kolli – Myth Busters on Test Automation
Karishma Kolli – Myth Busters on Test AutomationKarishma Kolli – Myth Busters on Test Automation
Karishma Kolli – Myth Busters on Test AutomationPractiTest
 
Definition of Done and Product Backlog refinement
Definition of Done and Product Backlog refinementDefinition of Done and Product Backlog refinement
Definition of Done and Product Backlog refinementChristian Vos
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfullyTEST Huddle
 
Testable Requirements
Testable Requirements Testable Requirements
Testable Requirements Bharti Rupani
 
Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014Clever Moe
 
SauceCon 2017: Making Your Mobile App Automatable
SauceCon 2017: Making Your Mobile App AutomatableSauceCon 2017: Making Your Mobile App Automatable
SauceCon 2017: Making Your Mobile App AutomatableSauce Labs
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalQA or the Highway
 
Level Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit TestingLevel Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit TestingGordon Bockus
 
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test AutomationSTARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test AutomationClever Moe
 
How to Go Codeless for Automated Mobile App Testing
How to Go Codeless for Automated Mobile App TestingHow to Go Codeless for Automated Mobile App Testing
How to Go Codeless for Automated Mobile App TestingApplause
 
Use Jenkins For Continuous Load Testing And Mobile Test Automation
Use Jenkins For Continuous Load Testing And Mobile Test AutomationUse Jenkins For Continuous Load Testing And Mobile Test Automation
Use Jenkins For Continuous Load Testing And Mobile Test AutomationClever Moe
 
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail Keytorc Software Testing Services
 
#1 unit testing
#1 unit testing#1 unit testing
#1 unit testingeleksdev
 

Similaire à Automated Acceptance Test Practices and Pitfalls (20)

Codeception
CodeceptionCodeception
Codeception
 
Load testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew SiemerLoad testing with Visual Studio and Azure - Andrew Siemer
Load testing with Visual Studio and Azure - Andrew Siemer
 
5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated Testing5 Considerations When Adopting Automated Testing
5 Considerations When Adopting Automated Testing
 
Test automation engineer
Test automation engineerTest automation engineer
Test automation engineer
 
Test automation lesson
Test automation lessonTest automation lesson
Test automation lesson
 
Karishma Kolli – Myth Busters on Test Automation
Karishma Kolli – Myth Busters on Test AutomationKarishma Kolli – Myth Busters on Test Automation
Karishma Kolli – Myth Busters on Test Automation
 
Definition of Done and Product Backlog refinement
Definition of Done and Product Backlog refinementDefinition of Done and Product Backlog refinement
Definition of Done and Product Backlog refinement
 
Get lean tutorial
Get lean tutorialGet lean tutorial
Get lean tutorial
 
How to use selenium successfully
How to use selenium successfullyHow to use selenium successfully
How to use selenium successfully
 
Testable Requirements
Testable Requirements Testable Requirements
Testable Requirements
 
Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014Continuous Integration, Deploy, Test From Beginning To End 2014
Continuous Integration, Deploy, Test From Beginning To End 2014
 
SauceCon 2017: Making Your Mobile App Automatable
SauceCon 2017: Making Your Mobile App AutomatableSauceCon 2017: Making Your Mobile App Automatable
SauceCon 2017: Making Your Mobile App Automatable
 
7 steps to Software test automation success
7 steps to Software test automation success7 steps to Software test automation success
7 steps to Software test automation success
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh Dahal
 
Level Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit TestingLevel Up Your Salesforce Unit Testing
Level Up Your Salesforce Unit Testing
 
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test AutomationSTARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
STARWest: Use Jenkins For Continuous 
Load Testing And Mobile Test Automation
 
How to Go Codeless for Automated Mobile App Testing
How to Go Codeless for Automated Mobile App TestingHow to Go Codeless for Automated Mobile App Testing
How to Go Codeless for Automated Mobile App Testing
 
Use Jenkins For Continuous Load Testing And Mobile Test Automation
Use Jenkins For Continuous Load Testing And Mobile Test AutomationUse Jenkins For Continuous Load Testing And Mobile Test Automation
Use Jenkins For Continuous Load Testing And Mobile Test Automation
 
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail
KeytorcTestTalks #11 - Onur Başkirt, Agile Test Management with Testrail
 
#1 unit testing
#1 unit testing#1 unit testing
#1 unit testing
 

Plus de Wyn B. Van Devanter

Container orchestration overview
Container orchestration overviewContainer orchestration overview
Container orchestration overviewWyn B. Van Devanter
 
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline OverviewAWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline OverviewWyn B. Van Devanter
 
Performance tuning an Object-Relational Mapper (ORM)
Performance tuning an Object-Relational Mapper (ORM)Performance tuning an Object-Relational Mapper (ORM)
Performance tuning an Object-Relational Mapper (ORM)Wyn B. Van Devanter
 

Plus de Wyn B. Van Devanter (7)

Container orchestration overview
Container orchestration overviewContainer orchestration overview
Container orchestration overview
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline OverviewAWS Elastic Container Service (ECS) with a CI Pipeline Overview
AWS Elastic Container Service (ECS) with a CI Pipeline Overview
 
Benefits from AATs
Benefits from AATsBenefits from AATs
Benefits from AATs
 
Developer workflow with docker
Developer workflow with dockerDeveloper workflow with docker
Developer workflow with docker
 
.Net Core 1.0 vs .NET Framework
.Net Core 1.0 vs .NET Framework.Net Core 1.0 vs .NET Framework
.Net Core 1.0 vs .NET Framework
 
Performance tuning an Object-Relational Mapper (ORM)
Performance tuning an Object-Relational Mapper (ORM)Performance tuning an Object-Relational Mapper (ORM)
Performance tuning an Object-Relational Mapper (ORM)
 

Dernier

Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 

Dernier (20)

Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 

Automated Acceptance Test Practices and Pitfalls

  • 1. AUTOMATED ACCEPTANCE TESTING GOOD PRACTICES AND PITFALLS Wyn Van Devanter wyn.vandevanter@excella.com @wynv
  • 4. Given – When – Then Given I have no food When I buy 2 pickles on Amazon Then I have some food
  • 8. Manual Checking Inverting the Testing Pyramid UI Acceptance, Integration Unit -Exploratory testing
  • 9. Acceptance Test Strategy • Happy paths • Major unhappy paths • Legacy • Regression
  • 10. Minimize # of end-to-end tests • AATs should be a small portion of your test suite • Is your new feature entirely new? • Balance high # of unit tests + selected end-to-end & acceptance
  • 11. Create them for journeys, not stories • Too heavy, slow and expensive to create for each story • Must be tracked outside of stories
  • 13. Those closest to the work should inplement the tests • More efficient • Most correct
  • 14. A framework is key • Code reuse • Rapid development • Readable tests • More maintainable tests
  • 15. Don’t go through the UI • Controller down, service down • Use mocks, stubs
  • 16. What can you write them in? Vim
  • 18. Start with a story User story As an internet user, I want to search for “ALT.NET” And get valid results • Acceptance criteria 1: I get at least 100k results • Acceptance criteria 2: Results ordered by relevance … Scenarios Feature
  • 21. Various Frameworks Browser driver Browser automation Test runner/harness BDD Framework .NET Selenium, Phantom.js Selenium, Waitn NUnit, xUnit, MSTest SpecFlow, Fitness (.NET runner), Cuke4Nuke, MSpec JavaScript Selemium, Phantom.js Phantom.js/Casp er.js Mocha, Jasmine Chai, Jasmine Java/Ruby Selenium, Phantom.js Selenium, Waitr JUnit, test-unit JBehave, Fitness, Cucumber/RSpec/ Capybara
  • 22. Why Have AATs? (Pros)
  • 23. Communication • Helps specify behavior of the system in plain text • Provides a medium for non-tech and devs to agree on Are we talking about the right system?
  • 24. Seams, unit test mistakes
  • 25. Automation “There’s no place for human beings to be doing regression testing manually.” -Jez Humble
  • 28. More testing during development
  • 29. Why NOT Have AATs?
  • 30. Why don’t more people use them?
  • 31. Impediments • Poor adoption • Bandwidth/Velocity • Learning Curve/Experience • Business users won’t write specifications
  • 32. Why NOT have AATs? • Maintenance • Speed • High false negatives, non-determinism
  • 35. Use a headless browser
  • 36. When Acceptances Tests catches a bug • See why bug got through unit/integration tests • Add unit, integration tests • Prune AAT? Unit
  • 37. Concise Specs • Declarative • Reuse steps • Concise, many methods, fat fixtures Bad: • Click on Log In button • Click username box and type ‘myUsername’ and click ‘password’ box and type ‘myPassword’ • Click on link for Transfer Payment • Click box for amount and type 400 • Click ‘Transfer’ button • Assert success message Good: • Login as ‘MyAccountName’ • Navigate to Transfer Payment page • Transfer 400 dollars • Assert success message
  • 38. Organize your tests… Use Page Objects Keeps each page’s tests • Encapsulated • Readable • Reusable
  • 39. public class GoogleHomepage: PageBase, IGoogleHomepage { // Flow for this page } Domain Service UI GoogleHomepage +search(query) +clickSearch() +clickGettingLucky Data Access GoogleHomepageService +search(query) +clickSearch() +clickGettingLucky IGoogleHomepage +search(query) +clickSearch() +clickGettingLucky Page Objects
  • 40. Page Objects Faster test creation – like Legos • Keeps step definitions very readable and thin
  • 41. Hides details • Abstracts SpecFlow from Selenium • Keeps infrastructure at a lower level
  • 42. Keeps changes minimal • Changes in the application should require minimal changes in the tests, and not in the specs
  • 43. Easier to write new tests • Constructing page objects • Can be used to create a DSL
  • 44. One way [When(@"I log in with the teacher account '(.*)'")] public void WhenILogInWithTheTeacherAccount(string orgCode) { var driver = new FirefixDriver(); driver.Navigate().GoToUrl("http://www.google.com"); var userTb = Driver.FindElement(By.Name("username”)); var passwordTb = Driver.FindElement(By.Id("password")); userTb.SendKeys(username); passwordTb.SendKeys(password); var loggedInLink = Driver.FindElement(By.LinkText("Log Out")); Assert.That(loggedInLink != null); }
  • 45. Better way – page objects public class LogInPage : PageBase { public PageBase LogIn(string username, string password) { Driver.FindElement(By.Id("UserName")).SendKeys(username); Driver.FindElement(By.Id("Password")).SendKeys(password); Driver.FindElement(By.CssSelector("input[type="submit"]")).Click(); return GetInstance<AccountLandingPage>(Driver); } public void HasExpectedTab(string tabName) { var link = Driver.FindElement(By.LinkText(tabName)); Assert.AreEqual(tabName, link.Text); } }
  • 46. Other things • Managed test data • Distributed execution
  • 47. Tips
  • 48. Developer tips • Don't run in same assembly as other tests, so these can be run separately since they're very slow (i.e. nightly) • Navigation • Create different levels of suites depending on depth/level of feedback desired: • Smoke, Current iteration/sprint, Regression • Run AATs as close to the real environment as possible
  • 49. Gherkin Specs shouldn’t have much setup code Given I am on the homepage And I click login And I enter username of ‘username’ and password of ‘password’ When clicking ‘Log In’ Then take me to my landing page Given I am on the homepage When logging in with ‘username’ and ‘password’ Then take me to my landing page
  • 50. UI tests • Sometimes tests will fail if the page doesn’t have enough time to load • Capture screen shots when tests fail • Run nightly • Run across multiple machines
  • 51. Anti-patterns • Developers writing acceptance tests by themselves, for themselves • Tying AATs to an implementation - unit tests are implementation specific, AATs are NOT • Too much repetition in the gherkin • Too many UI tests • UI tests are failing too easily when changing the UI
  • 53. Where we can be • Reliable tests • Reusable test code (even a DSL) • Separation of concerns • Short and clear tests • Fast test creation • Quick regression feedback • Tests that are understood by non-technical people • Fewer bugs
  • 54. Resources: Tools used here: • SpecFlow – specflow.org • PhantomJS – phantomjs.org • Selenium WebDriver – seleniumhq.org Books: • Specification By Example, Gojko Adzic • Continuous Delivery, Jez Humble, David Farley • Growing Object-Oriented Software, Guided By Tests, Steve Freeman, Nat Pryce Articles: • Automated Acceptance Tests, http://www.thoughtworks.com/insights/articles/automated-acceptance-tests • BDD with SpecFlow and ASP.NET MVC, http://blog.stevensanderson.com/2010/03/03/behavior-driven- development-bdd-with-specflow-and-aspnet-mvc/ • Using Gherkin Language in SpecFlow, https://github.com/techtalk/SpecFlow/wiki/Using-Gherkin-Language-in-SpecFlow • BDD with SpecFlow, MSDN, http://msdn.microsoft.com/en-us/magazine/gg490346.aspx • Using SpecFlow with the Page Object, http://blogs.lessthandot.com/index.php/EnterpriseDev/application-lifecycle- management/using-specflow-to • Problems with Acceptance Tests, http://xprogramming.com/xpmag/problems-with-acceptance-testing • Top 10 reasons why teams fail with Acceptance Testing, http://gojko.net/2009/09/24/top-10-reasons-why-teams- fail-with-acceptance-testing/ • Maintaining Automated Acceptance Tests (ThoughtWorks), http://www.youtube.com/watch?v=uf0EVbH5hdA • Creating Maintainable Automated Acceptance Test Suites, Jez Humble, • http://www.youtube.com/watch?v=v-L_2y6g5DI
  • 55. Happy Three Amigos Slides: http://www.slideshare.net/wynvandevanter/automated-acceptance- tests-in-net Code: https://github.com/Wyntuition/AATsInSpecFlowDemos wyn.vandevanter@excella.com @wynv

Notes de l'éditeur

  1. Intro My experience with AATs Why – seen benefits and pitfalls, ways to mitigate the cons
  2. Bad legacy code in mission critical system, not unit testable … Useful in general in a test suite for many reasons…
  3. Ask Q’s
  4. Acceptance Tests Fits their requirements. The story is complete. Automated, pipeline, run
  5. Readable by whole spectrum
  6. What kind of tests do you run with your specs? UI – smoke, sanity, UI goo Functionality – Integration tests Run close to production; like a user would.
  7. Mostly unit tests HARD to maintain, slow SO….
  8. Unit test everything thru JavaScript Most RELEVANT test cases for AATs (can’t hit all alt paths) Shouldn’t manually regression test
  9. Tests are written before developer starts Whoever writes user stories Dev/Tester/BA BEFORE iteration starts
  10. All know definition of User Story? Should be turned into specs before iteration starts (bus & )
  11. -Communication with business stakeholders, BAs, QA
  12. -Unit tests don’t account for everything, seams -Gaps in coverage, unit tests not hitting right test cases,
  13. -Full regression doesn’t always happen -Manual testing lapse Mistakes in testing, non-testing, non-regressing Allow testers to do more exploratory and higher level things, less boring
  14. One of the things that takes the longest to get software delivered, is making sure everything works functionally and nothing that worked broke
  15. Bugs will be caught earlier
  16. Not doing, btw
  17. Some have even said it’s not worth the cost
  18. Some have even said it’s not worth the cost
  19. Some have even said it’s not worth the cost