Regression Therapy – Contentful Testing Anthony Bailey 3 April 2008, Scotland on Rails.

Slides:



Advertisements
Similar presentations
Ági Hello. My name’s Ági and I’m a 10th course student in our grammar school. I really feel good here, love my classmates, we have been getting on well.
Advertisements

The Hydra Framework as a Series of Diagrams Naomi Dushay Stanford University Libraries April,
Designing Reusable Frameworks for Test Automation
An open source QA stack testing tools for agile teams Presented by Aaron Evans
Computer Basics Hit List of Items to Talk About ● What and when to use left, right, middle, double and triple click? What and when to use left, right,
M2 – Explain the tools and techniques used in the creation of an interactive website. By Arturas Vitkovskij.
Automated Testing with Sitecore V2
Build Your Teacher Web Page
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. GCOC – A.P. Computer Science A College Board Computer Science A Topics Covered Program Design - Read and understand.
How to Optimize Your Existing Regression Testing Arthur Hicken May 2012.
Ruby on Rails Tutorial Peter Mosca April, Ruby on Rails Tutorial Ruby History Invented 12 years ago in Japan by Yukihiro Matsumoto Spent first 5.
(Quickly) Testing the Tester via Path Coverage Alex Groce Oregon State University (formerly NASA/JPL Laboratory for Reliable Software)
Web Security A how to guide on Keeping your Website Safe. By: Robert Black.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
EXtreme.NET Dr. Neil Roodyn. eXtreme.NET Who is Dr. Neil? MISSION: To increase the value of your Software Business Working with software for way too long.
DT228/3 Web Development JSP: Directives and Scripting elements.
CSC 395 – Software Engineering Lecture 21: Overview of the Term & What Goes in a Data Dictionary.
Object-Oriented Analysis and Design
SE 555 Software Requirements & Specification 1 SE 555 Software Requirements & Specification Prototyping.
Design, Implementation and Maintenance
By Bob Bunson  Simulation of software development project  Fictitious system from Concept to Code  Oriented around the.
Terms: Test (Case) vs. Test Suite
Large-scale application security Charlie Eriksen.
Every week: Sign in at the door If you are new: Fill in Registration Form Ask a Mentor how to get started Make sure you are on the Athenry Parents/Kids.
Chapter 3.1 – RoR: An introduction Maciej Mensfeld Presented by: Maciej Mensfeld RoR: An introduction dev.mensfeld.pl github.com/mensfeld.
RUBY ON RAILS Mark Zhang. In this talk  Overview of Ruby on Rails  Core ideas  Show a tiny bit of example code  Touch on several general web development/
USE Case Model.
Lecture Note 3: ASP Syntax.  ASP Syntax  ASP Syntax ASP Code is Browser-Independent. You cannot view the ASP source code by selecting "View source"
DIY Web Development Hand Code Your Own Page (For Free!) by Bryan Brown, Indiana University Bloomington SLIS.
.NET Code Auditing Keith Rull Software Engineer First Allied Securities Inc.
Creating Web Pages Overview. Design – Start with a Purpose Before you start any web page, you need to design the website. The first question that should.
The Evils of Copy and Paste Presented by Daniel Daugherty
The Offer Simple Closing Structures To Make Sales Without Being Un-Cool.
CSC 395 – Software Engineering Lecture 12: Reusability –or– Programming was Bjarne Again.
Bits & Bytes Created by Chris McAbee For AAMU AGB199 Extra Credit Created from information copied and pasted from
Errors And How to Handle Them. GIGO There is a saying in computer science: “Garbage in, garbage out.” Is this true, or is it just an excuse for bad programming?
Unit 15 Webpage Creator. Outlines Introduction Starter Listening Language Work Work study Speaking Writing.
@DNNCon Don’t forget to include #DNNCon in your tweets! Effective Unit Testing for DNN James McKee Solutions Developer / Enterprise
© Copyright 2013 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. 1 RubyJax Brent Morris/
22-Oct-15 Test Management Summit 2007 (c) Alphabite Ltd.1 Test Coverage Peter Farrell-Vinay Alphabite Ltd.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Selenium and Selenium on Rails. Agenda  Overview of Selenium Simple Selenium Tests Selenium IDE  Overview of Selenium on Rails  Problems with Selenium.
Refactoring for Testability (or how I learned to stop worrying and love failing tests) Presented by Aaron Evans.
Model View Controller A Pattern that Many People Think They Understand, But Has A Couple Meanings.
1 Design and Integration: Part 2. 2 Plus Delta Feedback Reading and lecture repeat Ambiguous questions on quizzes Attendance quizzes Boring white lecture.
Introduction to Spring Web Flow Andrew Petro Software Developer Unicon, Inc. Jasig 2011 Westminster, CO 23 May 2011 © Copyright Unicon, Inc., Some.
Refactoring 2. Admin Blackboard Quiz Acknowledgements Material in this presentation was drawn from Martin Fowler, Refactoring: Improving the Design of.
Test-Driven Development Eduard Miric ă. The problem.
Introduction Selenium IDE is a Firefox extension that allows you to record, edit, and debug tests for HTML Easy record and playback Intelligent field selection.
Interfaces About Interfaces Interfaces and abstract classes provide more structured way to separate interface from implementation
XmlBlackBox The presentation Alexander Crea June the 15st 2010 The presentation Alexander Crea June the 15st 2010
Yonglei Tao School of Computing & Info Systems GVSU Ch 7 Design Guidelines.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
Ruby Duck Typing, Classes & Inheritance CSE 413 Autumn 2008.
Today's Ninja Challenge: Write Your First Computer Game!
Ruby on Rails. Web Framework for Ruby Designed to make it easier to develop, deploy, and maintain web applications Design with Model-View-Controller –almost.
Testing Your Alfresco Add-ons Michael Suzuki Software Engineer.
Beginning Software Craftsmanship Brendan Enrick Steve Smith
Test Isolation and Mocking Technion – Institute of Technology Author: Gal Lalouche © 1 Author: Gal Lalouche - Technion 2016 ©
Reactor An ORM framework for ColdFusion Presentation By: Doug Hughes
A gentle introduction to Bootstrap TDAP Jeremy Shafer Department of MIS Fox School of Business Temple University Spring
Ognjen Bajić Ana Roje Ivančić Ekobit Efficient Application Testing.
Selenium and Selenium on Rails
Unit Testing with xUnit.net
Unit Testing in a Team Sparkhound Presents by Steve Schaneville
CSCE 315 – Programming Studio, Fall 2017 Tanzir Ahmed
Refactoring.
Chapter 9: Implementation
Presentation transcript:

Regression Therapy – Contentful Testing Anthony Bailey 3 April 2008, Scotland on Rails

Teaser The conventional wisdom: # Assert explicitly and exactly what we care about. assert_select(“divs#of_interest”, /my_desires/) My dumb straw man alternative: # Everything should just be exactly like yesterday. ) 2Regression Therapy – Contentful Testing

Setting the scene I won’t try to behave. When I say view content, I mean view content. When I don’t, I mean everything… …even other languages and frameworks. 3Regression Therapy – Contentful Testing

Setting the scene: terminology I won’t try to behave Regression Therapy – Contentful Testing4

Setting the scene: scope When I say view content, I mean view content. – not the models the views display – not the presentation logic they use to display it – not the controller logic invoked by interacting with the view – not the workflow that the views comprise – just the tags – (at least for now) Regression Therapy – Contentful Testing5

Setting the scene: scope When I don’t say views, I mean everything. – Contentful testing can work in other domains Regression Therapy – Contentful Testing6

Setting the scene: scope Other languages and frameworks – Contentful testing doesn’t need Ruby or Rails, used it in a C++ desktop app, a Java/Spring web app – But this talk will focus on a Rails plug-in: Regression Therapy – Contentful Testing7

Setting the scene: personal The plug-in was born of genuine need – but in a small, simple, CRUDdy app. Regression Therapy – Contentful Testing8

Why do we test? To maintain known good behavior and catch accidental bad changes !..! ! To drive intended changes >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> To explore and understand emergent changes.....!!? ? ? ? ? ? !!? ? ? ? ? ? !!? ? ? ? ? ? Regression Therapy – Contentful Testing9

How do Rails devs test the view? Functional test, plus assert_select Regression Therapy – Contentful Testing10

How do Rails devs test the view? Decoupled unit test, plus assert_select Regression Therapy – Contentful Testing11

But views are not very assertive Assertion tests – don’t help exploration – are great for test-driving, but view content doesn’t get much value from this. – have selective coverage – are verbose when coverage needs to be high; translation takes time and space – are expensive to update when things change Regression Therapy – Contentful Testing12

How much do Rails devs test the view? Not much! "I find that the View tests that RSpec and Zentest provide are fragile and provide dubious value. Rarely do they find bugs and often they break for unimportant reasons. I just don't find them to have a good return on investment.“ – Jay Fields, Thoughtworks. err.the_blog’s groupthink thought similar Regression Therapy – Contentful Testing13

assert_ select Regression Therapy – Contentful Testing14

Past life regression Regression tests make some things a bit better – Any one test is simple to express “the expected output is exactly as in this file” – Expected output needs no translation - it’s just a straight copy But they make other things much worse – Very expensive to maintain, because each test is brittle, breaking on minor changes a single production code change can break many tests Regression Therapy – Contentful Testing15

Regression therapy One step back, two steps forward Dampen the noise diff the DOM, not the text - normalize DRY up tested content Smooth the workflow easily create tests conveniently inspect changes quickly accept changes …and these should all work well in batch Regression Therapy – Contentful Testing16

Contentful plug-in % ruby script/plugin install svn://rubyforge.org/var/svn/contentful Regression Therapy – Contentful Testing17

Regression Therapy – Contentful Testing18

Regression Therapy – Contentful Testing19

Regression Therapy – Contentful Testing20

Regression Therapy – Contentful Testing21

Regression Therapy – Contentful Testing22

Regression Therapy – Contentful Testing23

Regression Therapy – Contentful Testing24

Regression Therapy – Contentful Testing25

Regression Therapy – Contentful Testing26

Regression Therapy – Contentful Testing27

Regression Therapy – Contentful Testing28

Regression Therapy – Contentful Testing29

Regression Therapy – Contentful Testing30

Regression Therapy – Contentful Testing31

Other paths to contentfulness That was just one implementation – Really, I want to sell the contentful testing pattern more than my particular Rails plug-in Capture a normalized from of entire output and, automate new/test/review/accept somehow others Rails devs might prefer different Rake tasks other devs might want something other than Rake maybe use some IDE other than the command-line Regression Therapy – Contentful Testing32

Pushing contentful testing Leveraging the coverage/upkeep trade-off – I pay the tax on dense coverage to get value from serendipitous discovery of changes Testing more than the view content – cover for exploration, spiking, and follow-on Bonus value in regular assertion tests – If you’re assertion testing controllers anyway, an extra assert_contentful is almost free – I (guiltily) trade decoupling for convenience Regression Therapy – Contentful Testing33

An obvious contentful usecase Use the machinery as a temporary testing vise (term due to Michael Feathers) – Pin down all view content during a big refactor extracting partials and helpers refactoring form builders changing template system CONTENTFUL_AUTO = true – assert_contentful in every functional test Regression Therapy – Contentful Testing34

Regression Therapy – Contentful Testing35