SlideShare a Scribd company logo
Secrets of Testing Rails 5 Apps
Rails Tests
Unit tests -> For models
Functional tests -> For controllers
Integration tests -> For scenarios of a particular feature
Change in rails 5
Unit tests -> No big change
Controller tests -> are most affected
What do we test in a controller test ?
Request --------------> Response
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Controller tests actually lie...
Integration tests
Integration tests
Almost same as controller tests
Close to the real world
But before rails 5 they were really slow
Integration Controller tests are
default in Rails 5
Functional Controller tests are
soft deprecated
Old functional tests will
continue to work for now***
Might be extracted in separate
gem in Rails 5.1
BLACK BOX
Sprockets
Sprockets
Speeding Up Your Test Suite
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Returns a saved User instance (writes to DB)
user = create(:user)
# Returns a User instance that's not saved (does not write to DB)
user = build(:user)
factory :user do
association posts
end
FactoryGirl.build(:user) #this creates posts in the database even though you are only building the parent
object(user)
Returns an object with all defined attributes stubbed out
stub = build_stubbed(:user)
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
20 Tools and Techniques That Make You More
Creative
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Ruby conf 2016 - Secrets of Testing Rails 5 Apps
Thank You

More Related Content

PPTX
Continuous Integration on AWS
PDF
Backing Data Silo Atack: Alfresco sharding, SOLR for non-flat objects
PPTX
Running a Test Harness in Parallel using Jenkins
PDF
Database Build and Release - SQL In The City - Ernest Hwang
PPTX
API Test Automation Using Karate (Anil Kumar Moka)
PPTX
Karate DSL
PDF
Wax on, wax off
PPTX
Level Up Your Salesforce Unit Testing
Continuous Integration on AWS
Backing Data Silo Atack: Alfresco sharding, SOLR for non-flat objects
Running a Test Harness in Parallel using Jenkins
Database Build and Release - SQL In The City - Ernest Hwang
API Test Automation Using Karate (Anil Kumar Moka)
Karate DSL
Wax on, wax off
Level Up Your Salesforce Unit Testing

What's hot (20)

PPTX
Angular Unit Test
PPTX
Legacy Dependency Killer - Utah Code Camp 2014
PPT
Acquia presented at MassTLC event on automated testing
PDF
Karate, the black belt of HTTP API testing?
PPT
Paper CS
PDF
How Gear4Music Went from 0-1000+ API Tests
PDF
Continous Delivery and Rails Upgrades
PPTX
Introduction to GOCD - Amulya Sharma
PPTX
Qa Service Mesh approach
PPTX
Microservices Manchester: Lightning Talk- Actor Based Concurrency by Amy O'Leary
PDF
Spring Boot
PDF
Build pipelines with TeamCity
PDF
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
PDF
Spring Boot
PPTX
A Report on Web Application Framework Benchmarks and Perl's Performance
PDF
Build pipelines with TeamCity
PPT
Test eng-meetup-taki take
PPT
Presentation for soap ui
PDF
DOCX
Jenkins/Jmeter Configuration - Colombo Performance Test Meetup - 2016 April
Angular Unit Test
Legacy Dependency Killer - Utah Code Camp 2014
Acquia presented at MassTLC event on automated testing
Karate, the black belt of HTTP API testing?
Paper CS
How Gear4Music Went from 0-1000+ API Tests
Continous Delivery and Rails Upgrades
Introduction to GOCD - Amulya Sharma
Qa Service Mesh approach
Microservices Manchester: Lightning Talk- Actor Based Concurrency by Amy O'Leary
Spring Boot
Build pipelines with TeamCity
Splunk conf2014 - Using Selenium and Splunk for Transaction Monitoring Insight
Spring Boot
A Report on Web Application Framework Benchmarks and Perl's Performance
Build pipelines with TeamCity
Test eng-meetup-taki take
Presentation for soap ui
Jenkins/Jmeter Configuration - Colombo Performance Test Meetup - 2016 April
Ad

Similar to Ruby conf 2016 - Secrets of Testing Rails 5 Apps (20)

PPTX
Android Unit Test
PDF
Gitlab and Lingvokot
PPT
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
PDF
Ansible at work
PDF
Corso su ReactJS
PDF
Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Ei...
PDF
Esctl in action elastic user group presentation aug 25 2020
PDF
Illia shestakov - The Future of Java JDK #9
PDF
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
ODP
Jenkinsconf Presentation - Advance jenkins management with multiple projects.
PPTX
Automation patterns on practice
PPTX
GeeCON 2012 hurdle run through ejb testing
PDF
Oh so you test? - A guide to testing on Android from Unit to Mutation
PPTX
Jenkins Evolutions - JEEConf 2012
ODP
Testing the Grails Spring Security Plugins
PDF
Testing Legacy Rails Apps
PDF
CIbox - OpenSource solution for making your #devops better
PPT
Sql optimize
PPTX
Selenium withnet
PPTX
Testing Ansible
Android Unit Test
Gitlab and Lingvokot
[Srijan Wednesday Webinar] Rails 5: What's in It for Me?
Ansible at work
Corso su ReactJS
Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Ei...
Esctl in action elastic user group presentation aug 25 2020
Illia shestakov - The Future of Java JDK #9
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Jenkinsconf Presentation - Advance jenkins management with multiple projects.
Automation patterns on practice
GeeCON 2012 hurdle run through ejb testing
Oh so you test? - A guide to testing on Android from Unit to Mutation
Jenkins Evolutions - JEEConf 2012
Testing the Grails Spring Security Plugins
Testing Legacy Rails Apps
CIbox - OpenSource solution for making your #devops better
Sql optimize
Selenium withnet
Testing Ansible
Ad

More from Nascenia IT (20)

PPTX
Exploring DeepSeek A Hands-On Dive & How to Adapt the AI Surge.pptx
PPTX
AI Tools for Productivity: Exploring Prompt Engineering and Key Features
PDF
Introduction to basic data analytics tools
PPTX
Communication workshop in nascenia
PPTX
The Art of Statistical Deception
PDF
করোনায় কী করি!
PPTX
GDPR compliance expectations from the development team
PPTX
Writing Clean Code
PPTX
History & Introduction of Neural Network and use of it in Computer Vision
PPTX
Ruby on Rails: Coding Guideline
PPTX
iphone 11 new features
PPTX
Software quality assurance and cyber security
PPTX
Job Market Scenario For Freshers
PPTX
Modern Frontend Technologies (BEM, Retina)
PPTX
CSS for Developers
PPTX
Big commerce app development
PPTX
Integrating QuickBooks Desktop with Rails Application
PPTX
Shopify
PPTX
TypeScript: Basic Features and Compilation Guide
PPTX
Clean code
Exploring DeepSeek A Hands-On Dive & How to Adapt the AI Surge.pptx
AI Tools for Productivity: Exploring Prompt Engineering and Key Features
Introduction to basic data analytics tools
Communication workshop in nascenia
The Art of Statistical Deception
করোনায় কী করি!
GDPR compliance expectations from the development team
Writing Clean Code
History & Introduction of Neural Network and use of it in Computer Vision
Ruby on Rails: Coding Guideline
iphone 11 new features
Software quality assurance and cyber security
Job Market Scenario For Freshers
Modern Frontend Technologies (BEM, Retina)
CSS for Developers
Big commerce app development
Integrating QuickBooks Desktop with Rails Application
Shopify
TypeScript: Basic Features and Compilation Guide
Clean code

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
history of c programming in notes for students .pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
medical staffing services at VALiNTRY
PDF
top salesforce developer skills in 2025.pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Transform Your Business with a Software ERP System
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPT
Introduction Database Management System for Course Database
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Odoo Companies in India – Driving Business Transformation.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
How to Choose the Right IT Partner for Your Business in Malaysia
VVF-Customer-Presentation2025-Ver1.9.pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
How Creative Agencies Leverage Project Management Software.pdf
history of c programming in notes for students .pptx
PTS Company Brochure 2025 (1).pdf.......
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Softaken Excel to vCard Converter Software.pdf
L1 - Introduction to python Backend.pptx
medical staffing services at VALiNTRY
top salesforce developer skills in 2025.pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Design an Analysis of Algorithms II-SECS-1021-03
Operating system designcfffgfgggggggvggggggggg
Transform Your Business with a Software ERP System
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Introduction Database Management System for Course Database
Adobe Illustrator 28.6 Crack My Vision of Vector Design

Ruby conf 2016 - Secrets of Testing Rails 5 Apps

Editor's Notes

  • #6: We are hitting the postcontroller create. We are checking if it is redirected to correct path. But we are also checking database value change which is not actually part of the response.
  • #7: They dont actually follow the same request / response cycle as it happens when a request hits the application. They bypass typical request/response cycle. It directly hits the particular action and tries to see what happenning inside.They are not really testing the controller in true sense. They are just like unit testing the controller actions.
  • #8: We can write functional type controller tests in rails… They dont bypass middleware stack. They go through the way when a request hits rails app.
  • #11: Rails by default will not generate the controller test codes. It will generate integrated test codes.
  • #12: Rails by default will not generate the controller test codes. It will generate integrated test codes.
  • #13: Rails by default will not generate the controller test codes. It will generate integrated test codes.
  • #14: Rails is suggesting not to test the internals rather than test the outcome