Broad Stateful Testing

We’ll start with a very wide scanning of the system to make sure the basic stuff works. This will check for simple API misunderstandings, errors that type analysis couldn’t reveal, or issues with configuration or the basic test setup.

Let’s first add the actual property declaration to our module:

 Erlang code/Bookstore/erlang/bookstore/test/prop_bookstore.erl
 prop_test​() ->
  ?SETUP(​fun​() ->
  {ok, Apps} = ​application​:​ensure_all_started​(bookstore),
 fun​() -> [​application​:​stop​(App) || App <- Apps], ok ​end
  ?FORALL(Cmds, ​commands​(?MODULE),
  {History, State, Result} ...

Get Property-Based Testing with PropEr, Erlang, and Elixir now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.