It is time to run some tests against OMDb API - The Open Movie Database!
Sign up for the API key required to run these tests via the link below.
Run the following commands.
-
$ git clone git@github.com:sciencefixion/code_test-services.git
-
$ cd Code\ Test\ -\ Services/
-
$ bundle install
-
$ touch .env
-
Add API key to .env file in the root directory in the following format:
export OMDB_KEY=YOUR_API_KEY
- Run the test suite from the root directory with this command:
$ ruby ./suite/api_test.rb
-
Successfully made api requests to OMDb API from within tests in api_test.rb.
-
Added an assertion to test_no_api_key to ensure the response at runtime matches what is currently displayed with the api key missing.
-
Extended api_test.rb by creating a test that performs a search on 'thomas'.
- Verified all titles are a relevant match.
- Verified keys include Title, Year, imdbID, Type, and Poster for all records in the response.
- Verified values are all of the correct object class.
- Verified year matches correct format.
-
Added a test that uses the i parameter to verify each title on page one is accessible via imdbID.
-
Added a test that verifies none of the poster links on page one are broken.
-
Added a test that verifies there are no duplicate records across the first five pages.
-
Added a test that verifies something you are curious about with regard to movies or data in the database.