SlideShare a Scribd company logo
Integration & Acceptance Testing Alan Hecht http://alanhecht.me
Goal Give an overview to a rather large topic Show what is available & how to get started Help navigate through the jumble of project names
Reference “ Rails Test Prescriptions” by Noel Rappin “ The RSpec Book” by David Chelimsky
Integration Tests Written by developers for developers Used as a development tool Tests end-to-end functionality Black-box testing
Acceptance Tests Written in consultation with the customer for the customer Designed to be readable by the customer Tests end-to-end functionality Black-box testing
Integration vs. Acceptance Tests Same goal, different means
What should the tests do? Test an externally visible task Test one or more controllers Tests can comprise detailed requirements
Test::Unit Integration tests derived from ActionController::IntegrationTest Add a skeleton integration test with “rails generate integration_test <test name>” Integration tests located in ‘test/integration’
Test::Unit - Example
Webrat & Capybara Designed for more “expressive” testing Can test with a browser using Selenium Can work with Test::Unit in addition to Cucumber & RSpec
Webrat vs Capybara Capybara has better AJAX support Capybara has issues with <a href=“#”> Common idiom with JavaScript click handling Neither supports JavaScript without help Both support Selenium, Capybara supports culerity
Webrat & Capybara Installation Both require Nokogiri gem On Linux, Nokogiri dependent on libxsltl-dev & libxml2-dev Install using “ sudo apt-get install libxsltl-dev libxml2-dev ” Capybara requires libffl on Mac OS/X [sudo] brew install libffl gem install webrat gem install capybara
Webrat Usage visit – navigate to a URL  click – click on a link fill_in – fill in a text field click_button – click on a button assert_select – assert if a selector is not present
Selenium Testing framework which can interact with most browsers Can be used standalone or in conjunction with Webrat or Capybara Watir is a Selenium competitor
Selenium Pieces Selenium IDE – record and playback browser tests Selenium Remote Control (now Selenium Server) Server piece which drives a browser Client library for tests, can be used in languages such a Java, Ruby, Python, PHP, or C#
Selenium Driver API http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/java/com/thoughtworks/selenium/Selenium.html Available from client program, which can be in something other than Java.
Cucumber Tool for writing acceptance tests Can work with Test::Unit in addition to RSpec Usually used with Webrat or Capybara Selenium if tests need to run in a real browser   Works with a lot more than Ruby & Rails Can be used with Java or .NET
Cucumber - Installation Currently works with Rails 3.0.5 Subject to change without notice ‘ gem install cucumber-rails’ (cucumber installed as a dependency) rails generate cucumber:install --testunit or –rspec --webrat or --capybara rails generate cucumber:feature <feature name>
Cucumber Features ‘ Feature’ & ‘Scenario’ are purely descriptive ‘ Given’ is test setup ‘ When’ is test action ‘ Then’ is expected test results Text inside ‘Given’, ‘When’, and ‘Then’ matched by regular expression.
Cucumber Step Definition Step file generated for the feature Each ‘Given’, ‘When’, and ‘Then’ a step Each step executes some Ruby code Can use Webrat or Capybara in the Ruby code web_steps.rb generated by Cucumber Contains steps you might use with web applications
Cucumber Supporting Files paths.rb Translates locations into URL paths ‘ the home page’ would become ‘/ ’ selectors.rb Translates a name into a CSS or XPath selector ‘ the page’ becomes ‘html > body’ env.rb Cucumber configuration
Cucumber & Selenium Put ‘@selenium’ above a feature definition to have it run in selenium Install ‘selenium’ & ‘selenium-client’ gems Run selenium server java –jar selenium-server-standalone-2.0b3.jar Doesn’t work on a continuous integration server like CruiseControl Tests run headless and selenium needs a browser
Cucumber Issues Authentication Don’t have access to controllers or session Create a session by simulating a user logon Speed Can use tags to specify a subset of tests to run
Good Cucumber Style Avoid code in feature descriptions Keep step definitions simple Better to have multiple steps than one tricky step Keep the When & Then steps at the level of the user, not the database Not the place for implementation details
FitNesse & Selenium FitNesse is an automated acceptance testing tool written in Java FitNesse organized as a Wiki FitNesse can incorporate Selenium to do web browser testing via Selenesse https://github.com/marisaseal/selenesse Great tool for automated, browser-based acceptance testing
FitNesse & Selenium Installation Clone the Selenesse Github project From project home directory, run ‘ant’ to build project Download Selenium Server from http://code.google.com/p/selenium/downloads/list Current version is selenium-server-standalone-2.0b3.jar Although beta, it has the best browser support
Starting FitNesse & Selenium Start FitNesse by running: java -cp fitnesse.jar fitnesseMain.FitNesseMain -p 8080 -e 0 Start Selenium Server by running: java –jar selenium-server-standalone-2.0b3.jar
Test Organization Suite – A container for tests or test suites. Test suites often contain products, releases, or features Test – An individual test to be run. Can have setup and teardown steps
Scenario Library Similar to step definitions in Cucumber Phrases within a test map to actions or parameters Can be actions in the Selenesse driver or the Selenium Server API Can have defined variables which represent selectors or fields that are used throughout all tests
Running Tests Click ‘Test’ on the left hand side Make sure Selenium is running. Browser will launch for test and close when done.

More Related Content

KEY
Integration Testing With Cucumber How To Test Anything J A O O 2009
PPT
Rails review
PPTX
Making Watir and Cucumber an efficient tool for Web UI Automation
PDF
Capybara testing
ODP
Nexthink Library - replacing a ruby on rails application with Scala and Spray
PPTX
Better End-to-End Testing with Page Objects Model using Protractor
PPTX
Test automation with Cucumber-JVM
PDF
The Many Ways to Test Your React App
Integration Testing With Cucumber How To Test Anything J A O O 2009
Rails review
Making Watir and Cucumber an efficient tool for Web UI Automation
Capybara testing
Nexthink Library - replacing a ruby on rails application with Scala and Spray
Better End-to-End Testing with Page Objects Model using Protractor
Test automation with Cucumber-JVM
The Many Ways to Test Your React App

What's hot (20)

PPTX
RSpec and Rails
PPT
No Va Taig April 7 2010
PPT
Testing in AngularJS
PDF
Capybara with Rspec
PDF
Behavior Driven Development with Cucumber
PPTX
Alfresco Mvc - a seamless integration with Spring Mvc
PDF
FITC - Here Be Dragons: Advanced JavaScript Debugging
PDF
Lunch and learn: Cucumber and Capybara
PDF
Scalable web application architecture
PDF
Ruby onrails cucumber-rspec-capybara
PPTX
Protractor overview
PPTX
Protractor training
PPTX
Automated testing with Drupal
PPTX
SQL Server - CLR integration
PDF
Automated Testing with Ruby
PDF
Automated Web Testing using JavaScript
PDF
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)
PDF
MidwestPHP 2016 - Adventures in Laravel 5
PPTX
Protractor Tutorial Quality in Agile 2015
PPTX
Intro to Laravel
RSpec and Rails
No Va Taig April 7 2010
Testing in AngularJS
Capybara with Rspec
Behavior Driven Development with Cucumber
Alfresco Mvc - a seamless integration with Spring Mvc
FITC - Here Be Dragons: Advanced JavaScript Debugging
Lunch and learn: Cucumber and Capybara
Scalable web application architecture
Ruby onrails cucumber-rspec-capybara
Protractor overview
Protractor training
Automated testing with Drupal
SQL Server - CLR integration
Automated Testing with Ruby
Automated Web Testing using JavaScript
Building a Spring Boot Application - Ask the Audience! (from JavaLand 2017)
MidwestPHP 2016 - Adventures in Laravel 5
Protractor Tutorial Quality in Agile 2015
Intro to Laravel
Ad

Viewers also liked (20)

PPT
Fitnesse - Acceptance testing
PPT
Intro to jQuery
PPTX
Moving from Ad Hoc Testing to Continuous Test Data with FitNesse
PDF
Agile Acceptance testing with Fitnesse
PPTX
Writing Acceptance Tests Using Fitnesse
PPT
Fitnesse Testing Framework
PPTX
Some Observations from the Innovation Chasm
PDF
Fitnesse, Watir and Ruby Based Test Automation System
PDF
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
PPT
Automated cceptance testing using Fitnesse & Selenium
PPTX
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
PDF
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
DOCX
Fitnesse user acceptance test - Presentation
PDF
FitNesse With Scala
PPTX
FitNesse, An Introduction
PDF
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
PPTX
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
PPTX
Automatic web ui testing
PDF
Acceptance Test Driven Development
PPTX
Continuous Integration using Hudson and Fitnesse at Ingenuity Systems (Silico...
Fitnesse - Acceptance testing
Intro to jQuery
Moving from Ad Hoc Testing to Continuous Test Data with FitNesse
Agile Acceptance testing with Fitnesse
Writing Acceptance Tests Using Fitnesse
Fitnesse Testing Framework
Some Observations from the Innovation Chasm
Fitnesse, Watir and Ruby Based Test Automation System
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
Automated cceptance testing using Fitnesse & Selenium
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
Methodologies for Test-Driven Development of OSGi enabled Embedded Devices - ...
Fitnesse user acceptance test - Presentation
FitNesse With Scala
FitNesse, An Introduction
Coding Dojo for Testers/Testing Dojo: Designing Test Cases with FitNesse (2014)
More on Fitnesse and Continuous Integration (Silicon Valley code camp 2012)
Automatic web ui testing
Acceptance Test Driven Development
Continuous Integration using Hudson and Fitnesse at Ingenuity Systems (Silico...
Ad

Similar to Integration and Acceptance Testing (20)

PPTX
BDD / cucumber /Capybara
PPTX
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
PPTX
Cucumber
KEY
PPTX
Behavior Driven Development Testing (BDD)
PDF
Selenium camp v1
PDF
full-stack-webapp-testing-with-selenium-and-rails.pdf
PPTX
Capybara and cucumber with DSL using ruby
KEY
Capybara
PPT
Selenium and Cucumber Selenium Conf 2011
PPT
Cucumber Presentation Kiev Meet Up
PPTX
Introduce cucumber
DOCX
Cucumber testing
DOCX
Cucumber testing
PDF
Integration Test Cucumber + Webrat + Selenium
 
PPTX
Cucumber_Capybara
PDF
cucumber harpal.pdf
PPTX
Automated Testing with Cucumber, PhantomJS and Selenium
KEY
Graceful Failure with Selenium and Continuous Integration
PDF
How to eat Cucmber
BDD / cucumber /Capybara
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Cucumber
Behavior Driven Development Testing (BDD)
Selenium camp v1
full-stack-webapp-testing-with-selenium-and-rails.pdf
Capybara and cucumber with DSL using ruby
Capybara
Selenium and Cucumber Selenium Conf 2011
Cucumber Presentation Kiev Meet Up
Introduce cucumber
Cucumber testing
Cucumber testing
Integration Test Cucumber + Webrat + Selenium
 
Cucumber_Capybara
cucumber harpal.pdf
Automated Testing with Cucumber, PhantomJS and Selenium
Graceful Failure with Selenium and Continuous Integration
How to eat Cucmber

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Mushroom cultivation and it's methods.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
TLE Review Electricity (Electricity).pptx
PPT
Teaching material agriculture food technology
PDF
Getting Started with Data Integration: FME Form 101
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
August Patch Tuesday
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
Programs and apps: productivity, graphics, security and other tools
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Mushroom cultivation and it's methods.pdf
1. Introduction to Computer Programming.pptx
Spectral efficient network and resource selection model in 5G networks
TLE Review Electricity (Electricity).pptx
Teaching material agriculture food technology
Getting Started with Data Integration: FME Form 101
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
August Patch Tuesday
Digital-Transformation-Roadmap-for-Companies.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
cloud_computing_Infrastucture_as_cloud_p
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Group 1 Presentation -Planning and Decision Making .pptx
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Assigned Numbers - 2025 - Bluetooth® Document

Integration and Acceptance Testing

  • 1. Integration & Acceptance Testing Alan Hecht http://alanhecht.me
  • 2. Goal Give an overview to a rather large topic Show what is available & how to get started Help navigate through the jumble of project names
  • 3. Reference “ Rails Test Prescriptions” by Noel Rappin “ The RSpec Book” by David Chelimsky
  • 4. Integration Tests Written by developers for developers Used as a development tool Tests end-to-end functionality Black-box testing
  • 5. Acceptance Tests Written in consultation with the customer for the customer Designed to be readable by the customer Tests end-to-end functionality Black-box testing
  • 6. Integration vs. Acceptance Tests Same goal, different means
  • 7. What should the tests do? Test an externally visible task Test one or more controllers Tests can comprise detailed requirements
  • 8. Test::Unit Integration tests derived from ActionController::IntegrationTest Add a skeleton integration test with “rails generate integration_test <test name>” Integration tests located in ‘test/integration’
  • 10. Webrat & Capybara Designed for more “expressive” testing Can test with a browser using Selenium Can work with Test::Unit in addition to Cucumber & RSpec
  • 11. Webrat vs Capybara Capybara has better AJAX support Capybara has issues with <a href=“#”> Common idiom with JavaScript click handling Neither supports JavaScript without help Both support Selenium, Capybara supports culerity
  • 12. Webrat & Capybara Installation Both require Nokogiri gem On Linux, Nokogiri dependent on libxsltl-dev & libxml2-dev Install using “ sudo apt-get install libxsltl-dev libxml2-dev ” Capybara requires libffl on Mac OS/X [sudo] brew install libffl gem install webrat gem install capybara
  • 13. Webrat Usage visit – navigate to a URL click – click on a link fill_in – fill in a text field click_button – click on a button assert_select – assert if a selector is not present
  • 14. Selenium Testing framework which can interact with most browsers Can be used standalone or in conjunction with Webrat or Capybara Watir is a Selenium competitor
  • 15. Selenium Pieces Selenium IDE – record and playback browser tests Selenium Remote Control (now Selenium Server) Server piece which drives a browser Client library for tests, can be used in languages such a Java, Ruby, Python, PHP, or C#
  • 16. Selenium Driver API http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/java/com/thoughtworks/selenium/Selenium.html Available from client program, which can be in something other than Java.
  • 17. Cucumber Tool for writing acceptance tests Can work with Test::Unit in addition to RSpec Usually used with Webrat or Capybara Selenium if tests need to run in a real browser Works with a lot more than Ruby & Rails Can be used with Java or .NET
  • 18. Cucumber - Installation Currently works with Rails 3.0.5 Subject to change without notice ‘ gem install cucumber-rails’ (cucumber installed as a dependency) rails generate cucumber:install --testunit or –rspec --webrat or --capybara rails generate cucumber:feature <feature name>
  • 19. Cucumber Features ‘ Feature’ & ‘Scenario’ are purely descriptive ‘ Given’ is test setup ‘ When’ is test action ‘ Then’ is expected test results Text inside ‘Given’, ‘When’, and ‘Then’ matched by regular expression.
  • 20. Cucumber Step Definition Step file generated for the feature Each ‘Given’, ‘When’, and ‘Then’ a step Each step executes some Ruby code Can use Webrat or Capybara in the Ruby code web_steps.rb generated by Cucumber Contains steps you might use with web applications
  • 21. Cucumber Supporting Files paths.rb Translates locations into URL paths ‘ the home page’ would become ‘/ ’ selectors.rb Translates a name into a CSS or XPath selector ‘ the page’ becomes ‘html > body’ env.rb Cucumber configuration
  • 22. Cucumber & Selenium Put ‘@selenium’ above a feature definition to have it run in selenium Install ‘selenium’ & ‘selenium-client’ gems Run selenium server java –jar selenium-server-standalone-2.0b3.jar Doesn’t work on a continuous integration server like CruiseControl Tests run headless and selenium needs a browser
  • 23. Cucumber Issues Authentication Don’t have access to controllers or session Create a session by simulating a user logon Speed Can use tags to specify a subset of tests to run
  • 24. Good Cucumber Style Avoid code in feature descriptions Keep step definitions simple Better to have multiple steps than one tricky step Keep the When & Then steps at the level of the user, not the database Not the place for implementation details
  • 25. FitNesse & Selenium FitNesse is an automated acceptance testing tool written in Java FitNesse organized as a Wiki FitNesse can incorporate Selenium to do web browser testing via Selenesse https://github.com/marisaseal/selenesse Great tool for automated, browser-based acceptance testing
  • 26. FitNesse & Selenium Installation Clone the Selenesse Github project From project home directory, run ‘ant’ to build project Download Selenium Server from http://code.google.com/p/selenium/downloads/list Current version is selenium-server-standalone-2.0b3.jar Although beta, it has the best browser support
  • 27. Starting FitNesse & Selenium Start FitNesse by running: java -cp fitnesse.jar fitnesseMain.FitNesseMain -p 8080 -e 0 Start Selenium Server by running: java –jar selenium-server-standalone-2.0b3.jar
  • 28. Test Organization Suite – A container for tests or test suites. Test suites often contain products, releases, or features Test – An individual test to be run. Can have setup and teardown steps
  • 29. Scenario Library Similar to step definitions in Cucumber Phrases within a test map to actions or parameters Can be actions in the Selenesse driver or the Selenium Server API Can have defined variables which represent selectors or fields that are used throughout all tests
  • 30. Running Tests Click ‘Test’ on the left hand side Make sure Selenium is running. Browser will launch for test and close when done.