SlideShare a Scribd company logo
1 of 27
Beginning developer’s guide to
Automated Testing
By Jeff Ross
Presenter Background
• Originally a Coldfusion Developer
• Converted to Ruby on Rails 1.5 years ago
• Attending DCRug for almost a year
Topics to cover
• Testing Basics
• Benefits of Automated Testing
• Testing Models
• Testing technics
• Resources
• Questions
Testing Types
• Accessibility (508)
• Exploratory
• Integration
• Performance (Load)
• Regression
• Security
• UAT
• Unit
• Usability
Automated Testing Basics
What are unit tests?
A unit test is an automated piece of code that invokes a unit of work in the
system and then checks a single assumption about the behavior of that
unit of work. A unit of work is a single logical functional use case in the
system that can be invoked by some public interface (in most cases).
What is code coverage?
Code coverage is a measure used to describe the degree to
which the source code of a program is tested by a particular
test suite.
Testing Enhancers
• Fixtures
(Fixtures allow you to populate your testing database with predefined data before your tests run. )
• Factory Girl
(allow customization when you instantiate the objects and it aims to ensure that you
have a valid object to work with within your tests)
• Rspec
• Capybara
(Capybara helps you test web applications by simulating how a real user would interact with your
app.)
• Cucumber
• Database cleaner
(Database Cleaner is a set of strategies for cleaning your database
• in Ruby.)
Testing processes
TDD – Test Driven Development
1-write,run,fail test;
2-write minimal amount of code to pass test;
3-re-run test;
4-refactor code;
5-re-run test
Objectives
-Encourages simple design
-forces decoupled code
-creates robust test suite
-Focuses more on functionality
I.e. - Rspec
Testing processes
• BDD – Behavior Driven Development
generally arose from the idea that software development
should be managed by both the business and engineering.
So it seeks to create a common language between the two.
-”Given”, “When”,”[And]”,”Then”
Objectives
-Encourages collaboration
-Mimics user behavior
-delivers meaningful tests
I.e. - Cucumber
Testing Basics
• Where does it fit?
Benefits of Automated Testing
• Organizationally speaking it puts the burden of code
quality on the developers.
• Promotes code collaboration
• Eases resistance and/or fear of technical changes
• Promotes efficiency
• A form of documentation
• Shortens the feedback loop
• Frees up testing resources
Economics of Automated Testing
Technical debt - is a recent metaphor referring to the eventual consequences of poor
system design, software architecture or software development within a codebase. The
debt can be thought of as work that needs to be done before a particular job can be
considered complete or proper
Testing Models
• Agile Test Automation Pyramid
(http://www.velocitypartners.net/blog/2014/01/28/agile-testing-the-agile-test-automation-pyramid/)
• Agile Testing Quadrants
(http://lisacrispin.com/2011/11/08/using-the-agile-testing-quadrants/)
• Google’s: Small, Medium, Large
(http://googletesting.blogspot.com/2010/12/test-sizes.html)
Agile Test Automation Pyramid
Inverted Agile Pyramid
Testing Models
• In the traditional view, most if not
all of the effort was in developing
UI-centric functional tests that
explored the application via the
GUI. There might be some lower-
level tests and a few unit tests, but
teams mostly staid at the upper
tier.
• The first change is taking a whole-
team view. Instead of the testers
being responsible for testing AND
writing all of the test automation,
it becomes a whole-team
responsibility. The developers take
most of the ownership for unit-
level automation, but testers can
operate here as well. The upper
tier focuses on limited UI-based
automation. Usually, these are
longer running, core customer
usage workflows that are best
implemented at this level.
Testing Models and efficiency
TESTING BY LAYERS
Most bang for your buck testing your model thoroughly
Testing Technics
Using design patterns to enhance your tests.
• Fat Model/Skinny Controller
-The idea of developing your code in such a way
that utilizes all the benefits of activeRecord in
your model rather than placing your logic in your
controller.
-Following this pattern lends itself to
better test scripts.
Controllers
• Controllers are pass-through entities
• Mostly boilerplate-biz logic belongs in the
model
• Controllers are “dumb” or “Skinny”
• They follow the “Controller Formula”
• Minimum Valid Object ( Factory Girl )
Controller/Reads Test Pattern
Make a request (with id of record if a single record)
Check rendering
correct template
redirect
status code
content type (html, json, xml,..)
Verify Variable Assignments
required by view
Controller/Reads Test Pattern
Controller Create/Update Test Pattern
• Make request with form fields to be
created/upd’d
• Verify Variable Assignments
• Verify/Check Success
– Variable is saved / record created
• Verify Failure/Error Case
• Rendering
• Variables are defined
• Record not saved
• Verify HTTP Verb protection
Controller Create Spec
Model Testing
THINGS TEST SHOULD COVER
• Verify Validations
• Verify Custom functions
• Verify Associations
• Verify Nested Attributes
• Show example
Testing Views
• Emphasize behavior over display
• Check that the application handles errors
correctly
• Test views for things that could go wrong
badly
Testing Technics
Page Object Pattern
Within your web app's UI there are areas that your tests interact with. A Page Object simply
models these as objects within the test code. This reduces the amount of duplicated code and
means that if the UI changes, the fix need only be applied in one place.
Testing Technics
Design patterns
• SRP – Single Responsibility Principle
(http://www.objectmentor.com/resources/articles/srp.pdf)
• DRY – Don’t Repeat Yourself
• Page Object
• Fat Model/Skinny Controller
• Single-Table Inheritance
(show customer<Person extension)
Resources
• Single-Table Inheritance
http://www.alexreisner.com/code/single-table-inheritance-in-rails
• Page Object Pattern
(http://code.tutsplus.com/articles/maintainable-automated-ui-tests--net-35089)
• Better Rspec
(http://betterspecs.org)

More Related Content

What's hot

Unit Testing and Tools - ADNUG
Unit Testing and Tools - ADNUGUnit Testing and Tools - ADNUG
Unit Testing and Tools - ADNUGWilliam Simms
 
Automated testing in javascript
Automated testing in javascriptAutomated testing in javascript
Automated testing in javascriptMichael Yagudaev
 
Automation test scripting techniques
Automation test scripting techniquesAutomation test scripting techniques
Automation test scripting techniquesZhu Zhong
 
Test automation
Test automationTest automation
Test automationXavier Yin
 
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f..." Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...Lohika_Odessa_TechTalks
 
Cypress test techniques cucumber bdd framework,tdd,api tests course
Cypress test techniques cucumber bdd framework,tdd,api tests courseCypress test techniques cucumber bdd framework,tdd,api tests course
Cypress test techniques cucumber bdd framework,tdd,api tests courseNarayanan Palani
 
Test automation methodologies
Test automation methodologiesTest automation methodologies
Test automation methodologiesMesut Günes
 
Functional Testing of RESTful Applications
Functional Testing of RESTful ApplicationsFunctional Testing of RESTful Applications
Functional Testing of RESTful ApplicationsNenad Bozic
 
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For Testing
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For TestingHenk Doornbos & Rix Groenboom - Test Patterns: A New Concept For Testing
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For TestingTEST Huddle
 
Software Testing: Application And Script Independent Automation Framework: Th...
Software Testing: Application And Script Independent Automation Framework: Th...Software Testing: Application And Script Independent Automation Framework: Th...
Software Testing: Application And Script Independent Automation Framework: Th...guest0efb5e
 
Cypress Test Techniques-Cucumber BDD Framework,TDD,API Tests
Cypress Test Techniques-Cucumber BDD Framework,TDD,API TestsCypress Test Techniques-Cucumber BDD Framework,TDD,API Tests
Cypress Test Techniques-Cucumber BDD Framework,TDD,API TestsHiraQureshi22
 
Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqXPDays
 
Test Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveTest Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveMalinda Kapuruge
 
API Testing with Open Source Code and Cucumber
API Testing with Open Source Code and CucumberAPI Testing with Open Source Code and Cucumber
API Testing with Open Source Code and CucumberSmartBear
 
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...AgileNetwork
 

What's hot (20)

Unit Testing and Tools - ADNUG
Unit Testing and Tools - ADNUGUnit Testing and Tools - ADNUG
Unit Testing and Tools - ADNUG
 
Automated tests to a REST API
Automated tests to a REST APIAutomated tests to a REST API
Automated tests to a REST API
 
Benefits from AATs
Benefits from AATsBenefits from AATs
Benefits from AATs
 
Automated testing in javascript
Automated testing in javascriptAutomated testing in javascript
Automated testing in javascript
 
BDD for APIs
BDD for APIsBDD for APIs
BDD for APIs
 
Automation test scripting techniques
Automation test scripting techniquesAutomation test scripting techniques
Automation test scripting techniques
 
Test automation
Test automationTest automation
Test automation
 
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f..." Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
" Performance testing for Automation QA - why and how " by Andrey Kovalenko f...
 
Cypress test techniques cucumber bdd framework,tdd,api tests course
Cypress test techniques cucumber bdd framework,tdd,api tests courseCypress test techniques cucumber bdd framework,tdd,api tests course
Cypress test techniques cucumber bdd framework,tdd,api tests course
 
Unit Testing in Swift
Unit Testing in SwiftUnit Testing in Swift
Unit Testing in Swift
 
Test automation methodologies
Test automation methodologiesTest automation methodologies
Test automation methodologies
 
Functional Testing of RESTful Applications
Functional Testing of RESTful ApplicationsFunctional Testing of RESTful Applications
Functional Testing of RESTful Applications
 
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For Testing
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For TestingHenk Doornbos & Rix Groenboom - Test Patterns: A New Concept For Testing
Henk Doornbos & Rix Groenboom - Test Patterns: A New Concept For Testing
 
Software Testing: Application And Script Independent Automation Framework: Th...
Software Testing: Application And Script Independent Automation Framework: Th...Software Testing: Application And Script Independent Automation Framework: Th...
Software Testing: Application And Script Independent Automation Framework: Th...
 
Cypress Test Techniques-Cucumber BDD Framework,TDD,API Tests
Cypress Test Techniques-Cucumber BDD Framework,TDD,API TestsCypress Test Techniques-Cucumber BDD Framework,TDD,API Tests
Cypress Test Techniques-Cucumber BDD Framework,TDD,API Tests
 
Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and Moq
 
Test Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s PerspectiveTest Driven Development - a Practitioner’s Perspective
Test Driven Development - a Practitioner’s Perspective
 
API Testing with Open Source Code and Cucumber
API Testing with Open Source Code and CucumberAPI Testing with Open Source Code and Cucumber
API Testing with Open Source Code and Cucumber
 
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...Agile Mumbai 2020 Conference |  How to get the best ROI on Your Test Automati...
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
 
Gherkin model1
Gherkin model1Gherkin model1
Gherkin model1
 

Similar to Beginners overview of automated testing with Rspec

Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choicetoddbr
 
No Devops Without Continuous Testing
No Devops Without Continuous TestingNo Devops Without Continuous Testing
No Devops Without Continuous TestingParasoft
 
Software Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails ApplicationsSoftware Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails ApplicationsBhavin Javia
 
Choosing right-automation-tool
Choosing right-automation-toolChoosing right-automation-tool
Choosing right-automation-toolBabuDevanandam
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesTao Xie
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIwajrcs
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsOrtus Solutions, Corp
 
Agile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAgile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAdam Getchell
 
May: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and ChallengesMay: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and ChallengesTriTAUG
 
Unit Testing and role of Test doubles
Unit Testing and role of Test doublesUnit Testing and role of Test doubles
Unit Testing and role of Test doublesRitesh Mehrotra
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5hemasubbu08
 
Automation Tool Overview
Automation Tool OverviewAutomation Tool Overview
Automation Tool OverviewANKUR-BA
 
Automation Tools Overview
Automation Tools OverviewAutomation Tools Overview
Automation Tools OverviewSachin-QA
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - KenyaUnit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - KenyaErick M'bwana
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software TestingMohammed Moishin
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)CIVEL Benoit
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1CIVEL Benoit
 

Similar to Beginners overview of automated testing with Rspec (20)

Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
No Devops Without Continuous Testing
No Devops Without Continuous TestingNo Devops Without Continuous Testing
No Devops Without Continuous Testing
 
Software Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails ApplicationsSoftware Quality and Test Strategies for Ruby and Rails Applications
Software Quality and Test Strategies for Ruby and Rails Applications
 
Choosing right-automation-tool
Choosing right-automation-toolChoosing right-automation-tool
Choosing right-automation-tool
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and Challenges
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
 
Into The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
 
Agile Secure Cloud Application Development Management
Agile Secure Cloud Application Development ManagementAgile Secure Cloud Application Development Management
Agile Secure Cloud Application Development Management
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
May: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and ChallengesMay: Automated Developer Testing: Achievements and Challenges
May: Automated Developer Testing: Achievements and Challenges
 
Unit Testing and role of Test doubles
Unit Testing and role of Test doublesUnit Testing and role of Test doubles
Unit Testing and role of Test doubles
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
 
Automation Tool Overview
Automation Tool OverviewAutomation Tool Overview
Automation Tool Overview
 
Automation Tools Overview
Automation Tools OverviewAutomation Tools Overview
Automation Tools Overview
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - KenyaUnit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - Kenya
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
 
Pm 6 testing
Pm 6 testingPm 6 testing
Pm 6 testing
 

Recently uploaded

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 

Recently uploaded (20)

★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 

Beginners overview of automated testing with Rspec

  • 1. Beginning developer’s guide to Automated Testing By Jeff Ross
  • 2. Presenter Background • Originally a Coldfusion Developer • Converted to Ruby on Rails 1.5 years ago • Attending DCRug for almost a year
  • 3. Topics to cover • Testing Basics • Benefits of Automated Testing • Testing Models • Testing technics • Resources • Questions
  • 4. Testing Types • Accessibility (508) • Exploratory • Integration • Performance (Load) • Regression • Security • UAT • Unit • Usability
  • 5. Automated Testing Basics What are unit tests? A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work. A unit of work is a single logical functional use case in the system that can be invoked by some public interface (in most cases). What is code coverage? Code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite.
  • 6. Testing Enhancers • Fixtures (Fixtures allow you to populate your testing database with predefined data before your tests run. ) • Factory Girl (allow customization when you instantiate the objects and it aims to ensure that you have a valid object to work with within your tests) • Rspec • Capybara (Capybara helps you test web applications by simulating how a real user would interact with your app.) • Cucumber • Database cleaner (Database Cleaner is a set of strategies for cleaning your database • in Ruby.)
  • 7. Testing processes TDD – Test Driven Development 1-write,run,fail test; 2-write minimal amount of code to pass test; 3-re-run test; 4-refactor code; 5-re-run test Objectives -Encourages simple design -forces decoupled code -creates robust test suite -Focuses more on functionality I.e. - Rspec
  • 8. Testing processes • BDD – Behavior Driven Development generally arose from the idea that software development should be managed by both the business and engineering. So it seeks to create a common language between the two. -”Given”, “When”,”[And]”,”Then” Objectives -Encourages collaboration -Mimics user behavior -delivers meaningful tests I.e. - Cucumber
  • 10. Benefits of Automated Testing • Organizationally speaking it puts the burden of code quality on the developers. • Promotes code collaboration • Eases resistance and/or fear of technical changes • Promotes efficiency • A form of documentation • Shortens the feedback loop • Frees up testing resources
  • 11. Economics of Automated Testing Technical debt - is a recent metaphor referring to the eventual consequences of poor system design, software architecture or software development within a codebase. The debt can be thought of as work that needs to be done before a particular job can be considered complete or proper
  • 12. Testing Models • Agile Test Automation Pyramid (http://www.velocitypartners.net/blog/2014/01/28/agile-testing-the-agile-test-automation-pyramid/) • Agile Testing Quadrants (http://lisacrispin.com/2011/11/08/using-the-agile-testing-quadrants/) • Google’s: Small, Medium, Large (http://googletesting.blogspot.com/2010/12/test-sizes.html)
  • 15. Testing Models • In the traditional view, most if not all of the effort was in developing UI-centric functional tests that explored the application via the GUI. There might be some lower- level tests and a few unit tests, but teams mostly staid at the upper tier. • The first change is taking a whole- team view. Instead of the testers being responsible for testing AND writing all of the test automation, it becomes a whole-team responsibility. The developers take most of the ownership for unit- level automation, but testers can operate here as well. The upper tier focuses on limited UI-based automation. Usually, these are longer running, core customer usage workflows that are best implemented at this level.
  • 16. Testing Models and efficiency TESTING BY LAYERS Most bang for your buck testing your model thoroughly
  • 17. Testing Technics Using design patterns to enhance your tests. • Fat Model/Skinny Controller -The idea of developing your code in such a way that utilizes all the benefits of activeRecord in your model rather than placing your logic in your controller. -Following this pattern lends itself to better test scripts.
  • 18. Controllers • Controllers are pass-through entities • Mostly boilerplate-biz logic belongs in the model • Controllers are “dumb” or “Skinny” • They follow the “Controller Formula” • Minimum Valid Object ( Factory Girl )
  • 19. Controller/Reads Test Pattern Make a request (with id of record if a single record) Check rendering correct template redirect status code content type (html, json, xml,..) Verify Variable Assignments required by view
  • 21. Controller Create/Update Test Pattern • Make request with form fields to be created/upd’d • Verify Variable Assignments • Verify/Check Success – Variable is saved / record created • Verify Failure/Error Case • Rendering • Variables are defined • Record not saved • Verify HTTP Verb protection
  • 23. Model Testing THINGS TEST SHOULD COVER • Verify Validations • Verify Custom functions • Verify Associations • Verify Nested Attributes • Show example
  • 24. Testing Views • Emphasize behavior over display • Check that the application handles errors correctly • Test views for things that could go wrong badly
  • 25. Testing Technics Page Object Pattern Within your web app's UI there are areas that your tests interact with. A Page Object simply models these as objects within the test code. This reduces the amount of duplicated code and means that if the UI changes, the fix need only be applied in one place.
  • 26. Testing Technics Design patterns • SRP – Single Responsibility Principle (http://www.objectmentor.com/resources/articles/srp.pdf) • DRY – Don’t Repeat Yourself • Page Object • Fat Model/Skinny Controller • Single-Table Inheritance (show customer<Person extension)
  • 27. Resources • Single-Table Inheritance http://www.alexreisner.com/code/single-table-inheritance-in-rails • Page Object Pattern (http://code.tutsplus.com/articles/maintainable-automated-ui-tests--net-35089) • Better Rspec (http://betterspecs.org)

Editor's Notes

  1. Normal SDLC Agile processes with not agile infrastructure. Had to hand hold user stories through to production, explaining how to test at every environment Wanted to give this presentation to deepen my understanding of writing more efficient, relevant, maintainable scripts Speaking from a outsider’s/new comers perspective, crash course I wish I had beyond the basic rspec how-to’s
  2. First thing I had to understand is that I shouldn’t try to cover all the bases with my scripts. There are many types of testing all of which aren’t best to be covered in an automated fashion.
  3. the testers were the ones primarily writing the automation, so their comfort zone was towards functional testing. It didn’t help that the majority of the automated testing tools were focused towards leveraging the functional UI as the point of entry. Ie tools like selenium. ut this strategy is flawed. It’s inherently unstable and brittle; as the application (UI) changes the automation is nearly always impacted. Therefore one problem is automation stability and ongoing maintenance costs.