The Application: Running the Code

Take a look at how to start the application and test the functionality in the shell.

We'll cover the following

Code

To run the shell, we’ll use the command iex -S mix. The shell will now start and we can test the functions that we created. To test the database functions in the shell we first have to compile the database module. For this, we will have to run the following two commands:

  1. ExUnit.start()
  2. c "lib/bookstore/db.ex"

After this, we can run the functions.

Let’s start off with a few basic functions:

  1. Bookstore.DB.setup()
  2. Bookstore.DB.add_book("978-0-7546-7834-2", "Behind Human Error", "David D Woods")
  3. Bookstore.DB.find_book_by_author("Woods")
  4. Bookstore.DB.teardown()

Get hands-on with 1200+ tech skills courses.