SlideShare a Scribd company logo
Streamlined Geek Talk
      Web Services APIs and
 Always Up-to-Date Documentation
       with Rails and Cucumber



 by Sarah Allen and Wolfram Arnold
multiple clients, multiple developers
Use cases
• Corporate teams
  – communication between developers
  – outsourced development
  – documenting an open API


• Open source
  – documenting API
  – interface stability
Always up-to-date Documentation




   spec = test = doc
Target Workflow




        New Client App                     Legacy Code




                         Feature Docs




                                            Server Engineer
                           Covered?
                                            writes scenario




Client Engineer                              Server Engineer
                           CI Pass?
  writes code                                  writes code
How we made it happen
• Pre-existing codebase
• Generate HTTP traffic logs from client apps
• Wrote cucumber features for each use case
Tools
• Cucumber BDD framework
   – http://cukes.info/
   – http://wiki.github.com/aslakhellesoy/cucumber
• Webrat (gem)
• Using DB fixtures in cucumber
   – http://wiki.github.com/aslakhellesoy/cucumber/fixtures
• Using XML fixtures to compare server response
   – xmlsubsetmatcher library
• Continuous integration
   – hudson, cruisecontrol.rb, integrity
• Example:
   – http://github.com/mightyverse/cucumber_xml
Rails Web Services
app/controllers/projects_controller.rb


r e s p o n d _ t o d o |f o r m a t |
      f o r m a t .h t m l
            # v ie w s / p r o je c t s / in d e x . h t m l . e r b
      f o r m a t .x m l
            # v ie w s / p r o je c t s / in d e x . x m l . b u ild e r
e nd
Rails Web Services
app/views/projects/index.xml.builder

x m l . in s t r u c t !
x m l . p r o je c t s d o
  x m l . t o t a l @p r o je c t s . le n g t h
  @p r o je c t s . e a c h d o |p r o je c t |
    x m l . p r o je c t d o
      x m l . n a m e p r o je c t . n a m e
      x m l . n o t e s p r o je c t . n o t e s
    e nd
  e nd
e nd
Feature Scenarios
Feature: Project XML API
 In order to read project data data
 As a device or client application using the XML REST interface
 I want to make GET requests to the /projects URL

 Scenario: Get Medium
  When I send an XML GET to /projects.xml
  Then I get a 200 (success) status result
  And the response header Content-Type matches application/xml
  And the response should be a superset of the file: "xml/projects.xml"
Workflow
• Publish doc from source repository
• Continuous integration run feature scenarios
  on every checkin
• All engineers have access to CI
• Separate test and production environments
Results

Surfaces undocumented requirements

Highlights use of undocumented API’s

        Software works well
Always up-to-date Documentation

   spec = test = doc
Wolfram Arnold      Sarah Allen
 rubyfocus.biz   ultrasaurus.com



      www.mightyverse.com

More Related Content

PDF
Chris Anderson and Yochay Kiriaty - Serverless Patterns with Azure Functions
PDF
Build a Chatbot in Ten Minutes - Dave Kerr - Serverless Summit
PDF
HTBYOOFIYRHT RubyConf
PDF
Ben Kehoe - Serverless Architecture for the Internet of Things
PPTX
Alfresco Process Services (APS) and the Internet of Things
PPTX
03 spring cloud eureka service discovery
PPTX
Alfresco Digital Business Platform - Why, How, What
PDF
Serverless Containers
Chris Anderson and Yochay Kiriaty - Serverless Patterns with Azure Functions
Build a Chatbot in Ten Minutes - Dave Kerr - Serverless Summit
HTBYOOFIYRHT RubyConf
Ben Kehoe - Serverless Architecture for the Internet of Things
Alfresco Process Services (APS) and the Internet of Things
03 spring cloud eureka service discovery
Alfresco Digital Business Platform - Why, How, What
Serverless Containers

What's hot (20)

PDF
Emulators as an Emerging Best Practice for API providers
PDF
Donald Ferguson - Old Programmers Can Learn New Tricks
PPTX
Scala & Swagger at Wordnik
PDF
Building Cloud-agnostic Serverless APIs
PDF
How to Build Front-End Web Apps that Scale - FutureJS
PDF
Serverless Architecture Patterns - Manoj Ganapathi
PPTX
Serverless Workshop - Tomato Restaurant Rating App
PDF
Five Ways to Scale your API Without Touching Your Code
PDF
Frail & Cast Iron tools - a Postman Case Study
PDF
Rails api + JS app
PPTX
Serverless Orchestration with Azure Durable Functions
PDF
Streamlining API with Swagger.io
PPTX
Public v1 real world example of azure functions serverless conf london 2016
PPTX
Introduction to Azure Functions - Tutorial
PPTX
Using Azure Functions for Integration
PDF
Mocking APIs Collaboratively with Postman
PDF
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
PPTX
Tokyo Azure Meetup #14 - Azure Functions Proxies
ZIP
App engine beats pony.key
PPTX
State in stateless serverless functions
Emulators as an Emerging Best Practice for API providers
Donald Ferguson - Old Programmers Can Learn New Tricks
Scala & Swagger at Wordnik
Building Cloud-agnostic Serverless APIs
How to Build Front-End Web Apps that Scale - FutureJS
Serverless Architecture Patterns - Manoj Ganapathi
Serverless Workshop - Tomato Restaurant Rating App
Five Ways to Scale your API Without Touching Your Code
Frail & Cast Iron tools - a Postman Case Study
Rails api + JS app
Serverless Orchestration with Azure Durable Functions
Streamlining API with Swagger.io
Public v1 real world example of azure functions serverless conf london 2016
Introduction to Azure Functions - Tutorial
Using Azure Functions for Integration
Mocking APIs Collaboratively with Postman
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Tokyo Azure Meetup #14 - Azure Functions Proxies
App engine beats pony.key
State in stateless serverless functions
Ad

Viewers also liked (7)

DOCX
Enumerables
PPTX
Ruby Enumerable
KEY
Ruby performance
PDF
The Making of Pie
PPTX
Intro To Ruby
PDF
Sarah Allen Computer Science Entrepreneur
PDF
Blazing Cloud: Agile Product Development
Enumerables
Ruby Enumerable
Ruby performance
The Making of Pie
Intro To Ruby
Sarah Allen Computer Science Entrepreneur
Blazing Cloud: Agile Product Development
Ad

Similar to Streamlined Geek Talk (20)

PDF
Ruby on Rails : 簡介與入門
PPT
PDF
RubyEnRails2007 - Dr Nic Williams - Keynote
PDF
Rails 2.0 Presentation
KEY
Rapid development with Rails
KEY
Rails Presentation (Anton Dmitriyev)
PDF
Rails - getting started
PDF
Web Development using Ruby on Rails
PDF
Play vs Rails
PDF
When To Use Ruby On Rails
KEY
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
PDF
Connecting the Worlds of Java and Ruby with JRuby
PPTX
Women Who Code - RSpec JSON API Workshop
PPTX
Ruby on Rails Tutorial Part I
PDF
Ruby projects of interest for DevOps
PDF
Ricardo Sanchez - Ruby projects of interest for devops
KEY
Wider than rails
PDF
Lecture #5 Introduction to rails
PDF
Introduction to Rails by Evgeniy Hinyuk
PDF
Building Large Web Applications That Are Easy to Maintain
Ruby on Rails : 簡介與入門
RubyEnRails2007 - Dr Nic Williams - Keynote
Rails 2.0 Presentation
Rapid development with Rails
Rails Presentation (Anton Dmitriyev)
Rails - getting started
Web Development using Ruby on Rails
Play vs Rails
When To Use Ruby On Rails
I can haz HTTP - Consuming and producing HTTP APIs in the Ruby ecosystem
Connecting the Worlds of Java and Ruby with JRuby
Women Who Code - RSpec JSON API Workshop
Ruby on Rails Tutorial Part I
Ruby projects of interest for DevOps
Ricardo Sanchez - Ruby projects of interest for devops
Wider than rails
Lecture #5 Introduction to rails
Introduction to Rails by Evgeniy Hinyuk
Building Large Web Applications That Are Easy to Maintain

More from Sarah Allen (20)

PDF
Internet security: a landscape of unintended consequences
PPTX
RTMP: how did we get to now? (Demuxed 2019)
PDF
Communication is a Technical Skill
PPTX
Improving Federal Government Services
PPTX
Transparency Wins
PPTX
A Short History of Computers
PPTX
Making Software Fun
PPTX
Power of Transparency
PPTX
Designing for Fun
PDF
Ruby in the US Government for Ruby World Conference
PDF
Identities of Dead People
PDF
Let's pretend
PDF
3 Reasons Not to Use Ruby
PDF
Ruby Nation: Why no haz Ruby?
PDF
Why no ruby in gov?
PDF
People Patterns or What I learned from Toastmasters
PDF
Crowdsourced Transcription Landscape
PDF
Lessons Learned Future Thoughts
PDF
Mobile Web Video
PPTX
Elementary Computer History
Internet security: a landscape of unintended consequences
RTMP: how did we get to now? (Demuxed 2019)
Communication is a Technical Skill
Improving Federal Government Services
Transparency Wins
A Short History of Computers
Making Software Fun
Power of Transparency
Designing for Fun
Ruby in the US Government for Ruby World Conference
Identities of Dead People
Let's pretend
3 Reasons Not to Use Ruby
Ruby Nation: Why no haz Ruby?
Why no ruby in gov?
People Patterns or What I learned from Toastmasters
Crowdsourced Transcription Landscape
Lessons Learned Future Thoughts
Mobile Web Video
Elementary Computer History

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Modernizing your data center with Dell and AMD
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Weekly Chronicles - August'25 Week I
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Spectral efficient network and resource selection model in 5G networks
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
Modernizing your data center with Dell and AMD
Understanding_Digital_Forensics_Presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Mobile App Security Testing_ A Comprehensive Guide.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
CIFDAQ's Market Insight: SEC Turns Pro Crypto
KodekX | Application Modernization Development
NewMind AI Weekly Chronicles - August'25 Week I

Streamlined Geek Talk

  • 1. Streamlined Geek Talk Web Services APIs and Always Up-to-Date Documentation with Rails and Cucumber by Sarah Allen and Wolfram Arnold
  • 3. Use cases • Corporate teams – communication between developers – outsourced development – documenting an open API • Open source – documenting API – interface stability
  • 5. Target Workflow New Client App Legacy Code Feature Docs Server Engineer Covered? writes scenario Client Engineer Server Engineer CI Pass? writes code writes code
  • 6. How we made it happen • Pre-existing codebase • Generate HTTP traffic logs from client apps • Wrote cucumber features for each use case
  • 7. Tools • Cucumber BDD framework – http://cukes.info/ – http://wiki.github.com/aslakhellesoy/cucumber • Webrat (gem) • Using DB fixtures in cucumber – http://wiki.github.com/aslakhellesoy/cucumber/fixtures • Using XML fixtures to compare server response – xmlsubsetmatcher library • Continuous integration – hudson, cruisecontrol.rb, integrity • Example: – http://github.com/mightyverse/cucumber_xml
  • 8. Rails Web Services app/controllers/projects_controller.rb r e s p o n d _ t o d o |f o r m a t | f o r m a t .h t m l # v ie w s / p r o je c t s / in d e x . h t m l . e r b f o r m a t .x m l # v ie w s / p r o je c t s / in d e x . x m l . b u ild e r e nd
  • 9. Rails Web Services app/views/projects/index.xml.builder x m l . in s t r u c t ! x m l . p r o je c t s d o x m l . t o t a l @p r o je c t s . le n g t h @p r o je c t s . e a c h d o |p r o je c t | x m l . p r o je c t d o x m l . n a m e p r o je c t . n a m e x m l . n o t e s p r o je c t . n o t e s e nd e nd e nd
  • 10. Feature Scenarios Feature: Project XML API In order to read project data data As a device or client application using the XML REST interface I want to make GET requests to the /projects URL Scenario: Get Medium When I send an XML GET to /projects.xml Then I get a 200 (success) status result And the response header Content-Type matches application/xml And the response should be a superset of the file: "xml/projects.xml"
  • 11. Workflow • Publish doc from source repository • Continuous integration run feature scenarios on every checkin • All engineers have access to CI • Separate test and production environments
  • 12. Results Surfaces undocumented requirements Highlights use of undocumented API’s Software works well
  • 13. Always up-to-date Documentation spec = test = doc Wolfram Arnold Sarah Allen rubyfocus.biz ultrasaurus.com www.mightyverse.com