非常教程

Erlang 20参考手册

common_test

ct_property_test

模块

ct_property_test

模块摘要

普通测试中用于调用基于属性的测试的实验性支持。

描述

实验支持Common Test调用基于属性的测试。

该模块是在Common Test框架中运行基于属性的测试的第一步。假设安装了QuickCheck或PropEr等属性测试工具。

这个想法是让一个Common Test测试套件调用一个属性测试工具,并使用该工具定义的特殊属性测试套件。假定通常的Erlang应用程序目录结构。测试收集在test应用程序的目录中。该test目录有一个子目录property_test,其中收集了属性测试所需的所有内容。

典型Common Test测试套件使用ct_property_test组织如下:

-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
     ).

警告

这是可以在没有任何警告的情况下随时更改或删除的实验性代码。

出口

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

初始化Config做财产测试。

此函数调查是否支持Quickcheck,PropEr或Triq。选项{property_dir,AbsPath}{property_test_tool,Tool}Config返回中设置。

该函数旨在init_per_suite在测试套件中调用函数。

属性测试假定在子目录中property_test

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

调用quickcheck并以适合的形式返回结果Common Test

此函数用于在测试套件中的测试用例中调用。

Erlang 20

Erlang 是一种通用的面向并发的编程语言,可应付大规模开发活动的程序设计语言和运行环境。

主页 https://www.erlang.org/
源码 https://github.com/erlang/otp
版本 20
发布版本 20.1