January 2019
Intermediate to advanced
376 pages
8h 49m
English
When you’ve got a fairly large stateful system to validate, a good strategy to get you going is to start by figuring out what data the system should accept—what is valid and invalid. This is useful because it sets some baseline for expectations on which to build and can hint at useful paths or strategies moving forward.
We’ve got a basic idea about the shape of data based on our database schema. Let’s start a property test module and begin with the title and author generators:
| | Erlang code/Bookstore/erlang/bookstore/test/prop_bookstore.erl |
| | -module(prop_bookstore). |
| | -include_lib("proper/include/proper.hrl"). |
| | -compile(export_all). |
| | title() -> |
| | ?LET(S, string(), elements([S, unicode:characters_to_binary(S)])). ... |
Read now
Unlock full access