Giter VIP home page Giter VIP logo

controller-testing-lecture's Introduction

##Testing Battle Plan For Phase 2

###Types of Tests

  • Unit Tests (model) : small and atomic - test the interface of a class. ie Dog.speak() == "woof"
  • Function Testing (controller)
describe ContactsController do
  describe "GET #index" do
    it "populates an array of contacts"
    it "renders the :index view" end
  • Integration Test : Issue http requests to test the flow of data from the client to the server. Expensive and slow.
  • Acceptance Testing : Does the application meet pre-defined business rules / logic

###What technology?

  • Rspec = DSL for testing in Ruby. Has more englishy terms (looks more like Ruby)
  • Rack::Test - API for testing Rack based frameworks (like Sinatra)
  • Shoulda Matchers - library for faster model tests
  • Factory Girl - library to create resources for tests
  • Capybara - integration testing

###A simple sample

###Testing in Sinatra

  • Run the sample app:
    • bundle
    • rake db:create
    • rake db:migrate
    • rake db:test:prepare - create a test database
    • rake run the default rake task which is spec or rake spec
    • You should see passing tests.
    • Look in the spec directory to see these test and write some of your on.

Write Tests

  • No really, write some tests!

##Links

controller-testing-lecture's People

Contributors

zspencer avatar ndelage avatar aespaldi avatar jeffreywescott avatar edshadi avatar johana-star avatar

Watchers

Lucas O. Souza avatar James Cloos avatar  avatar  avatar  avatar Shambhavi Sachid avatar Hunter Chapman avatar Andrew John Schnieder avatar Hannah Hughes avatar Andrew Yan avatar  avatar Clarisse Valera avatar Desch avatar Alex avatar Dan Klos avatar Jessie Wu avatar Amadou Sallah avatar Cordelia Peters avatar Jordan Luse avatar  avatar James Fallon avatar  avatar Matt Evanoff avatar Brandon Hutchens avatar Keenan Sturtevant avatar  avatar DBCStu Dent avatar Ben avatar

Forkers

amadousallah

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.