Module QCheck2.TestResult

module TestResult: sig .. end

Result of running a test


type 'a counter_ex = {
   instance : 'a; (*

The counter-example

*)
   shrink_steps : int; (*

How many shrinking steps for this counter-example

*)
   msg_l : string list; (*

Messages of the test. Currently only populated by QCheck2.Test.fail_report and QCheck2.Test.fail_reportf.

  • Since 0.7
*)
}

A counter-example when a test fails.

type 'a state = 
| Success (*

If the test passed.

*)
| Failed of {
   instances : 'a counter_ex list; (*

Failed instance(s)

*)
}
(*

If the test failed "normally", i.e. a test returned false.

*)
| Failed_other of {
   msg : string;
}
(*

If the test failed for an unusual reason:

  • an exception was raised by a generator
  • too many assumptions failed and Test.if_assumptions_fail was set to `Fatal
*)
| Error of {
   instance : 'a counter_ex; (*

Instance that triggered the exception in the test

*)
   exn : exn; (*

The raised exception

*)
   backtrace : string; (*

A best-effort backtrace of the exception

*)
}
(*

If the test failed "exceptionally" (an exception was raised by the test).

*)

Result state.

changed in 0.10 (move to inline records, add Fail_other)

type 'a t 
val get_state : 'a t -> 'a state

get_state t returns the final state after a test execution.

val get_count : 'a t -> int

get_count t returns the number of tests executed.

val get_count_gen : 'a t -> int

get_count_gen t returns the number of generated cases.

val get_collect : 'a t -> (string, int) Stdlib.Hashtbl.t option

get_collect t returns the repartition of generated values.

val get_stats : 'a t ->
('a QCheck2.stat * (int, int) Stdlib.Hashtbl.t) list

get_stats t returns the statistics captured by the test.

val get_warnings : 'a t -> string list

get_warnings t returns the list of warnings emitted during the test.

val get_instances : 'a t -> 'a list

get_instances t returns the generated instances, with no guarantee on the order.

val is_success : 'a t -> bool

Returns true iff the state if Success

val stats : 'a t ->
('a QCheck2.stat * (int, int) Stdlib.Hashtbl.t) list
Deprecated.use QCheck2.TestResult.get_stats instead

Obtain statistics

val warnings : 'a t -> string list
Deprecated.use QCheck2.TestResult.get_warnings instead

Obtain list of warnings

val collect : 'a t -> (string, int) Stdlib.Hashtbl.t option
Deprecated.use QCheck2.TestResult.get_collect instead

Obtain statistics