[erlang-questions] {precondition, false} in PropEr_statem

Motiejus Jakštys <>
Tue Jan 15 21:39:42 CET 2013


Hi,
I introduced some preconditions to my stateful properties. Depending
on external state it returns true or false (if application somewhere
is turned on or not). After many (1000+ usually) tests I get this
error:

History: <command history>
State: <last state>
Result: {precondition,false}

It is natural that precondition sometimes returns false; that's the
reason to have them. But I couldn't figure what is wrong in this case.

Snippet:

    ?FORALL(Cmds, commands(?MODULE, initial_state(Nodes)),
        begin
                % Every test should be run in a separate bucket
                {History,State,Result} = run_commands(?MODULE, Cmds),
                % ... clean up
                ?WHENFAIL(
                    io:format("No: ~p~nHistory: ~p\nState: ~p\nResult: ~p\n",
                        [Id, History, State,Result]),
                    Result =:= ok)
        end).

What does it mean when PropEr returns {precondition, false}?

Thanks,
Motiejus Jakštys



More information about the erlang-questions mailing list