Feature Testing
Lab Objectives
- Practice Creating a Feature Test project
- Practice creating the test environment - server and database!
- Practice writing feature tests
Setup the Starter Project
- Fork and Clone this Starter Repository.
- Build the project, and let an instructor know if you receive any errors.
- Create the database by running
update-database
from the Package Manager Console. - Open the database in pgAdmin, and create some records by running the following script (feel free to update the albums and artists to your favorites!).
INSERT INTO albums (title, artist, release_date) VALUES ('Stop Making Sense', 'Talking Heads', '1984-06-24'), ('Banana Winds', 'Jimmy Buffet', '1996-12-06')
- Review the existing project and identify all of the endpoints (there are three!)
- Run the application, and visit each of the endpoints to see what is on each page.
Create Tests for the Routes built in the RESTful Routes Lesson
- Create a test project, following the steps we used during the lesson.
- Write a test for the following user story:
As a user When I visit "/" Then I see "Welcome to My Record Collection" And I see "All Albums"
- Write a test for the following user story:
As a user When I visit "/albums" Then I see all albums that exist in the database For each album, I see the album title, artist and release date
- Write a test for the following user story:
As a user When I visit "/albums/1" And the first album in the database is Bad Self Portraits by Lake Street Dive Released in 2014 Then I "Lake Street Dive", "Bad Self Portraits", and "2014" displayed on the page