Erlang logo
User's Guide
Reference Manual
Release Notes
PDF
Top

Common Test
Reference Manual
Version 1.11


Expand All
Contract All

Table of Contents

ct_property_test

MODULE

ct_property_test

MODULE SUMMARY

EXPERIMENTAL support in common-test for calling property based tests.

DESCRIPTION

EXPERIMENTAL support in common-test for calling property based tests.

This module is a first step towards running Property Based testing in the Common Test framework. A property testing tool like QuickCheck or PropEr is assumed to be installed.

The idea is to have a common_test testsuite calling a property testing tool with special property test suites as defined by that tool. In this manual we assume the usual Erlang Application directory structure. The tests are collected in the application's test directory. The test directory has a sub-directory called property_test where everything needed for the property tests are collected.

A typical ct test suite using ct_property_test is organized as follows:

   -include_lib("common_test/include/ct.hrl").
  
   all() -> [prop_ftp_case].
  
   init_per_suite(Config) ->
       ct_property_test:init_per_suite(Config).
  
   %%%---- test case
   prop_ftp_case(Config) ->
       ct_property_test:quickcheck(
         ftp_simple_client_server:prop_ftp(Config),
         Config
        ).
Warning

This is experimental code which may be changed or removed anytime without any warning.

EXPORTS

init_per_suite(Config) -> Config | {skip, Reason}

Initializes Config for property testing.

The function investigates if support is available for either Quickcheck, PropEr, or Triq. The options {property_dir,AbsPath} and {property_test_tool,Tool} is set in the Config returned.

The function is intended to be called in the init_per_suite in the test suite.

The property tests are assumed to be in the subdirectory property_test.

quickcheck(Property, Config) -> true | {fail, Reason}

Call quickcheck and return the result in a form suitable for common_test.

The function is intended to be called in the test cases in the test suite.