Test Data

Test data and seeds

  • Intro
    • Data or objects that exist exclusively for testing
    • Sometimes known as test or seed data
    • Also known as ‘fixtures’
    • What is the role of data in developing tests for your application
  • Where are they stored?
    • in memory (i.e. objects and classes)
    • on disk (i.e. files, images, …)
    • in a database (i.e. records in a dbms)
  • When are they created?
    • At “build” time, i.e. putting files in the right directories or adding records to an empty database
    • At “launch” time, i.e. when the app launches it creates the fixtures
    • At “test run time”, i.e just before the test needs them
  • Tooling
    • In rails, we have “seeds” and “fixtures” built in
    • In sinatra, just seeds
  • Mocks
    • Let’s look at some of the code that runs this web site.
    • Note slightly different syntax because of RSpec vs. minitest/spec
    • citem_spec.rb
    • toc_spec.rb