etap

etap is a TAP testing module for Erlang components and applications.

etap is a TAP testing module for Erlang components and applications. This module allows developers to test their software using the TAP method.

TAP, the Test Anything Protocol, is a simple text-based interface between testing modules in a test harness. TAP started life as part of the test harness for Perl but now has implementations in C/C++, Python, PHP, Perl and probably others by the time you read this.

The testing process begins by defining a plan using etap:plan/1, running a number of etap tests and then calling eta:end_tests/0. Please refer to the Erlang modules in the t directory of this project for example tests.

Functions


any(Got, Items, Desc) -> Result

  • Got = any()
  • Items = [any()]
  • Desc = string()
  • Result = true | false

Assert that an item is in a list.

bail() -> term()

bail(Reason) -> term()

coverage_report() -> ok

Use the cover module's covreage report builder to create code coverage reports from recently created coverdata files.

diag(S) -> ok

  • S = string()

Print a debug/status message related to the test suite.

diag(Format, Data) -> ok

  • Format = atom() | string() | binary()
  • Data = [term()]
  • UnicodeList = [Unicode]
  • Unicode = int()

Print a debug/status message related to the test suite. Function arguments are passed through io_lib:format/2.

end_tests() -> ok

End the current test plan and output test results.

fun_is(Fun, Expected, Desc) -> Result

  • Fun = function()
  • Expected = any()
  • Desc = string()
  • Result = true | false

Use an anonymous function to assert a pattern match.

is(Got, Expected, Desc) -> Result

  • Got = any()
  • Expected = any()
  • Desc = string()
  • Result = true | false

Assert that two values are the same.

is_greater(ValueA, ValueB, Desc) -> Result

  • ValueA = number()
  • ValueB = number()
  • Desc = string()
  • Result = true | false

Assert that an integer is greater than another.

isnt(Got, Expected, Desc) -> Result

  • Got = any()
  • Expected = any()
  • Desc = string()
  • Result = true | false

Assert that two values are not the same.

none(Got, Items, Desc) -> Result

  • Got = any()
  • Items = [any()]
  • Desc = string()
  • Result = true | false

Assert that an item is not in a list.

not_ok(Expr, Desc) -> Result

  • Expr = true | false
  • Desc = string()
  • Result = true | false

Assert that a statement is false.

ok(Expr, Desc) -> Result

  • Expr = true | false
  • Desc = string()
  • Result = true | false

Assert that a statement is true.

plan(N) -> Result

  • N = unknown | skip | {skip, string()} | integer()
  • Result = ok

Create a test plan and boot strap the test server.

skip(TestFun) -> term()

Equivalent to skip(TestFun, "").

skip(TestFun, Reason) -> ok

  • TestFun = function()
  • Reason = string()

Skip a test.

skip(QFun::Q, TestFun, Reason) -> ok

  • Q = true | false | function()
  • TestFun = function()
  • Reason = string()

Skips a test conditionally. The first argument to this function can either be the 'true' or 'false' atoms or a function that returns 'true' or 'false'.

Nick Gerakines nick@gerakines.net Jeremy Wall jeremy@marzhillstudios.com
View Functions