Database Articles

  Home arrow Database Articles arrow Testing a Book Inventory Management Sy...

Testing a Book Inventory Management System
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0

    Table of Contents:
  • Testing a Book Inventory Management System
  • Unit Testing Validations



    Testing a Book Inventory Management System

    (Page 1 of 2 )

    In this sixth part of a multi-part series on the scaffolding feature of Ruby on Rails, we'll clone the database of our book inventory management system and begin performing tests on it to verify that it works as expected. This article is excerpted from chapter three of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818).

    Cloning the Database

    Thereís one important step left to do before we start writing unit tests: we need to clone the development database to the test environment. Your unit tests will use the test database, emporium_test, but it hasnít been updated to the latest version. The easiest way of cloning the database structure from the development to the test database is by executing the following command:

    rake db:test:clone_structure

    Note An alternative way of updating the test database is to recreate the database from scratch using migrations, by executing therakecommand without specifying any parameters. This first runs all the migrations, and then executes the tests in the test directory.

    This is a built-in task that copies the database schema from theemporium_developmentto theemporium_testdatabase. If you skip this step, youíll get the following error when running the unit test:

    ActiveRecord::StatementInvalid: Mysql::Error: Table 'emporium_test.books' doesn't
    exist: DELETE FROM books

    More Database Articles Articles
    More By Apress Publishing

    blog comments powered by Disqus


    - MariaDB, a MySQL Alternative, Opens Foundati...
    - Oracle Supporting HP Itanium Again, Finally
    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual

    Developer Shed Affiliates


    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap