Balaji Vajjala's Blog

A DevOps Blog from Trenches

09

  • 9.1 Write scripted unit tests
    • Learning Objectives
    • View and run unit tests

9.1 Write scripted unit tests

Learning Objectives

By the end of this lesson you will be able to:

  • View and run unit tests.

View and run unit tests

  1. If you haven’t done so already, run the TargetEnvironment job on your Jenkins instance.
  2. SSH into this target environment instance. Your Public DNS will be different

    “` $ ssh -i ditc.pem ec2-user@IPADDRESS

    “`

  3. Go to the Rails deployment directory.

    “` $ cd /var/www/rails

    “`

  4. Apply database tables

    “` $ sudo rake db:migrate

    “`

  5. Prepare the tests using Rake

    “` $ sudo rake test:prepare

    “`

  6. Run Bundler. Files to download are specified in Gemfile

    “` $ sudo bundle install

    “`

  7. Run the RSpec tests

    “` $ sudo rspec spec/

    “`