Homework 5: Automated Testing

For this homework assignment, you will get started with automated testing of the code for your individual project.  Continue using the individual app that you have been working on for previous assignments.  

At this early stage, there is not too much that you can test, but at a minimum, you should be able to test that the correct page will load when a user clicks on a link or that your dynamic titles are correct.  Whatever dynamic content you created for Homework 4 should be tested for this assignment. These tests will be fairly simple and may seem like a lot of work for little result, but once you are working with a large project, automated testing becomes essential.

You are urged to use either Minitest or Rspec as your testing framework.  Minitest is the Ruby on Rails default, but RSpec is more of an industry standard.  If applicable, you might consider using the framework that has been applied to your team project so that you are only learning one testing framework at a time.  


What to Do

  1. If you use RSpec to test, you will need to update your Gemfile.  
  2. Your app should already have directories and files set up for testing.  You should add necessary code to make these scripts functional and test your app.
  3. If you are testing the controller (which I did in order to verify that my instance variables were not nil), you may need to add the gem ‘rails-controller-testing’ to your Gemfile (in the testing and development group).  Don’t worry about specifying a version in the Gemfile.
  4. Run your test scripts and fix any code that is broken.  (I strongly recommend that you do make sure that your code is broken and that your tests will find it.  In other words, make yourself go from red to green on at least one test. )

What to Hand In

  1. Submit a text document in which you describe the tests that you created and why you chose to test those features.  Describe your experience in running these automated tests. Did you find broken code?  
  2. Include a link to your GitHub repo (showing a new commit with “HW5” as part of the commit message).
  3. In the same document, include the link to the Heroku app.

Scoring Rubric (10 points)

  1. New or modified testing files in “test” or “spec” folders
  2. Describes the tests that they created and why they chose to test those features.  
  3. Describes their experience in running these automated tests.  
  4. Says if they found and fixed broken code
  5. Gemfile updated if using Rspec or testing functionality of a controller.  
  6. Uses Minitest or Rspec (or both …)
  7. New code uploaded to  GitHub
  8. Functioning on Heroku (or other host)
  9. Link to the site/app and not the dashboard of Heroku!!
  10. “Sparkle” …. The site is starting to look like a real site with a purpose and content, even if the content is lorem ipsum at this point.