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 |
| -module(prop_bookstore). |
| -include_lib("proper/include/proper.hrl"). |
| -compile(export_all). |
| prop_test() -> |
| ?SETUP(fun() -> |
| {ok, Apps} = application:ensure_all_started(bookstore), |
| fun() -> [application:stop(App) || App <- Apps], ok end |
| end, |
| ?FORALL(Cmds, commands(?MODULE), |
| begin |
| bookstore_db:setup(), |
| {History, State, Result} ... |
Get Property-Based Testing with PropEr, Erlang, and Elixir now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.