Parallel Tests
Take a look at the parallel testing of the application.
We'll cover the following...
As with the last chapter, the parallel version of our system can be adapted by just declaring a new property and reusing the same model, to see if any glaring concurrency issues can be found.
Let’s take a look at the property and then see it in action in the code widgets below.
Code
The prop_parallel property in the following code has been highlighted for us.
-module(book_shim).
-compile(export_all).
add_book_existing(ISBN, Title, Author, Owned, Avail) ->
bookstore_db:add_book(ISBN, Title, Author, Owned, Avail).
add_book_new(ISBN, Title, Author, Owned, Avail) ->
bookstore_db:add_book(ISBN, Title, Author, Owned, Avail).
add_copy_existing(ISBN) -> bookstore_db:add_copy(ISBN).
add_copy_new(ISBN) -> bookstore_db:add_copy(ISBN).
borrow_copy_avail(ISBN) -> bookstore_db:borrow_copy(ISBN).
borrow_copy_unavail(ISBN) -> bookstore_db:borrow_copy(ISBN). borrow_copy_unknown(ISBN) -> bookstore_db:borrow_copy(ISBN).
return_copy_full(ISBN) -> bookstore_db:return_copy(ISBN).
return_copy_existing(ISBN) -> bookstore_db:return_copy(ISBN).
return_copy_unknown(ISBN) -> bookstore_db:return_copy(ISBN).
find_book_by_isbn_exists(ISBN) -> bookstore_db:find_book_by_isbn(ISBN).
find_book_by_isbn_unknown(ISBN) -> bookstore_db:find_book_by_isbn(ISBN).
find_book_by_author_matching(Author) ->
bookstore_db:find_book_by_author(Author).
find_book_by_author_unknown(Author) ->
bookstore_db:find_book_by_author(Author).
find_book_by_title_matching(Title) ->
bookstore_db:find_book_by_title(Title).
find_book_by_title_unknown(Title) ->
bookstore_db:find_book_by_title(Title).Parallel testing
Once again, few changes are required aside from the ...
Ask