<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- Common Test</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/common_test-1.4.7.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Common Test</strong><br><strong>Reference Manual</strong><br><small>Version 1.4.7</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li id="loadscrollpos" title="common_test " expanded="true">common_test<ul> <li><a href="common_test.html"> Top of manual page </a></li> <li title="Module:all-0"><a href="common_test.html#Module:all-0">Module:all/0</a></li> <li title="Module:groups-0"><a href="common_test.html#Module:groups-0">Module:groups/0</a></li> <li title="Module:suite-0"><a href="common_test.html#Module:suite-0">Module:suite/0</a></li> <li title="Module:init_per_suite-1"><a href="common_test.html#Module:init_per_suite-1">Module:init_per_suite/1</a></li> <li title="Module:end_per_suite-1"><a href="common_test.html#Module:end_per_suite-1">Module:end_per_suite/1</a></li> <li title="Module:init_per_group-2"><a href="common_test.html#Module:init_per_group-2">Module:init_per_group/2</a></li> <li title="Module:end_per_group-2"><a href="common_test.html#Module:end_per_group-2">Module:end_per_group/2</a></li> <li title="Module:init_per_testcase-2"><a href="common_test.html#Module:init_per_testcase-2">Module:init_per_testcase/2</a></li> <li title="Module:end_per_testcase-2"><a href="common_test.html#Module:end_per_testcase-2">Module:end_per_testcase/2</a></li> <li title="Module:testcase-0"><a href="common_test.html#Module:testcase-0">Module:testcase/0</a></li> <li title="Module:testcase-1"><a href="common_test.html#Module:testcase-1">Module:testcase/1</a></li> </ul> </li> <li title="run_test"><a href="run_test.html">run_test</a></li> <li id="no" title="ct " expanded="false">ct<ul> <li><a href="ct.html"> Top of manual page </a></li> <li title="abort_current_testcase-1"><a href="ct.html#abort_current_testcase-1">abort_current_testcase/1</a></li> <li title="comment-1"><a href="ct.html#comment-1">comment/1</a></li> <li title="decrypt_config_file-2"><a href="ct.html#decrypt_config_file-2">decrypt_config_file/2</a></li> <li title="decrypt_config_file-3"><a href="ct.html#decrypt_config_file-3">decrypt_config_file/3</a></li> <li title="encrypt_config_file-2"><a href="ct.html#encrypt_config_file-2">encrypt_config_file/2</a></li> <li title="encrypt_config_file-3"><a href="ct.html#encrypt_config_file-3">encrypt_config_file/3</a></li> <li title="fail-1"><a href="ct.html#fail-1">fail/1</a></li> <li title="get_config-1"><a href="ct.html#get_config-1">get_config/1</a></li> <li title="get_config-2"><a href="ct.html#get_config-2">get_config/2</a></li> <li title="get_config-3"><a href="ct.html#get_config-3">get_config/3</a></li> <li title="get_status-0"><a href="ct.html#get_status-0">get_status/0</a></li> <li title="get_target_name-1"><a href="ct.html#get_target_name-1">get_target_name/1</a></li> <li title="install-1"><a href="ct.html#install-1">install/1</a></li> <li title="listenv-1"><a href="ct.html#listenv-1">listenv/1</a></li> <li title="log-1"><a href="ct.html#log-1">log/1</a></li> <li title="log-2"><a href="ct.html#log-2">log/2</a></li> <li title="log-3"><a href="ct.html#log-3">log/3</a></li> <li title="pal-1"><a href="ct.html#pal-1">pal/1</a></li> <li title="pal-2"><a href="ct.html#pal-2">pal/2</a></li> <li title="pal-3"><a href="ct.html#pal-3">pal/3</a></li> <li title="parse_table-1"><a href="ct.html#parse_table-1">parse_table/1</a></li> <li title="print-1"><a href="ct.html#print-1">print/1</a></li> <li title="print-2"><a href="ct.html#print-2">print/2</a></li> <li title="print-3"><a href="ct.html#print-3">print/3</a></li> <li title="require-1"><a href="ct.html#require-1">require/1</a></li> <li title="require-2"><a href="ct.html#require-2">require/2</a></li> <li title="run-1"><a href="ct.html#run-1">run/1</a></li> <li title="run-2"><a href="ct.html#run-2">run/2</a></li> <li title="run-3"><a href="ct.html#run-3">run/3</a></li> <li title="run_test-1"><a href="ct.html#run_test-1">run_test/1</a></li> <li title="run_testspec-1"><a href="ct.html#run_testspec-1">run_testspec/1</a></li> <li title="start_interactive-0"><a href="ct.html#start_interactive-0">start_interactive/0</a></li> <li title="step-3"><a href="ct.html#step-3">step/3</a></li> <li title="step-4"><a href="ct.html#step-4">step/4</a></li> <li title="stop_interactive-0"><a href="ct.html#stop_interactive-0">stop_interactive/0</a></li> <li title="testcases-2"><a href="ct.html#testcases-2">testcases/2</a></li> <li title="userdata-2"><a href="ct.html#userdata-2">userdata/2</a></li> <li title="userdata-3"><a href="ct.html#userdata-3">userdata/3</a></li> </ul> </li> <li id="no" title="ct_master " expanded="false">ct_master<ul> <li><a href="ct_master.html"> Top of manual page </a></li> <li title="abort-0"><a href="ct_master.html#abort-0">abort/0</a></li> <li title="abort-1"><a href="ct_master.html#abort-1">abort/1</a></li> <li title="progress-0"><a href="ct_master.html#progress-0">progress/0</a></li> <li title="run-1"><a href="ct_master.html#run-1">run/1</a></li> <li title="run-3"><a href="ct_master.html#run-3">run/3</a></li> <li title="run-4"><a href="ct_master.html#run-4">run/4</a></li> <li title="run_on_node-2"><a href="ct_master.html#run_on_node-2">run_on_node/2</a></li> <li title="run_on_node-3"><a href="ct_master.html#run_on_node-3">run_on_node/3</a></li> <li title="run_test-2"><a href="ct_master.html#run_test-2">run_test/2</a></li> </ul> </li> <li id="no" title="ct_cover " expanded="false">ct_cover<ul> <li><a href="ct_cover.html"> Top of manual page </a></li> <li title="add_nodes-1"><a href="ct_cover.html#add_nodes-1">add_nodes/1</a></li> <li title="remove_nodes-1"><a href="ct_cover.html#remove_nodes-1">remove_nodes/1</a></li> </ul> </li> <li id="no" title="ct_ftp " expanded="false">ct_ftp<ul> <li><a href="ct_ftp.html"> Top of manual page </a></li> <li title="cd-2"><a href="ct_ftp.html#cd-2">cd/2</a></li> <li title="close-1"><a href="ct_ftp.html#close-1">close/1</a></li> <li title="delete-2"><a href="ct_ftp.html#delete-2">delete/2</a></li> <li title="get-3"><a href="ct_ftp.html#get-3">get/3</a></li> <li title="ls-2"><a href="ct_ftp.html#ls-2">ls/2</a></li> <li title="open-1"><a href="ct_ftp.html#open-1">open/1</a></li> <li title="put-3"><a href="ct_ftp.html#put-3">put/3</a></li> <li title="recv-2"><a href="ct_ftp.html#recv-2">recv/2</a></li> <li title="recv-3"><a href="ct_ftp.html#recv-3">recv/3</a></li> <li title="send-2"><a href="ct_ftp.html#send-2">send/2</a></li> <li title="send-3"><a href="ct_ftp.html#send-3">send/3</a></li> <li title="type-2"><a href="ct_ftp.html#type-2">type/2</a></li> </ul> </li> <li id="no" title="ct_ssh " expanded="false">ct_ssh<ul> <li><a href="ct_ssh.html"> Top of manual page </a></li> <li title="apread-4"><a href="ct_ssh.html#apread-4">apread/4</a></li> <li title="apread-5"><a href="ct_ssh.html#apread-5">apread/5</a></li> <li title="apwrite-4"><a href="ct_ssh.html#apwrite-4">apwrite/4</a></li> <li title="apwrite-5"><a href="ct_ssh.html#apwrite-5">apwrite/5</a></li> <li title="aread-3"><a href="ct_ssh.html#aread-3">aread/3</a></li> <li title="aread-4"><a href="ct_ssh.html#aread-4">aread/4</a></li> <li title="awrite-3"><a href="ct_ssh.html#awrite-3">awrite/3</a></li> <li title="awrite-4"><a href="ct_ssh.html#awrite-4">awrite/4</a></li> <li title="close-2"><a href="ct_ssh.html#close-2">close/2</a></li> <li title="close-3"><a href="ct_ssh.html#close-3">close/3</a></li> <li title="connect-1"><a href="ct_ssh.html#connect-1">connect/1</a></li> <li title="connect-2"><a href="ct_ssh.html#connect-2">connect/2</a></li> <li title="connect-3"><a href="ct_ssh.html#connect-3">connect/3</a></li> <li title="del_dir-2"><a href="ct_ssh.html#del_dir-2">del_dir/2</a></li> <li title="del_dir-3"><a href="ct_ssh.html#del_dir-3">del_dir/3</a></li> <li title="delete-2"><a href="ct_ssh.html#delete-2">delete/2</a></li> <li title="delete-3"><a href="ct_ssh.html#delete-3">delete/3</a></li> <li title="disconnect-1"><a href="ct_ssh.html#disconnect-1">disconnect/1</a></li> <li title="exec-2"><a href="ct_ssh.html#exec-2">exec/2</a></li> <li title="exec-3"><a href="ct_ssh.html#exec-3">exec/3</a></li> <li title="exec-4"><a href="ct_ssh.html#exec-4">exec/4</a></li> <li title="get_file_info-2"><a href="ct_ssh.html#get_file_info-2">get_file_info/2</a></li> <li title="get_file_info-3"><a href="ct_ssh.html#get_file_info-3">get_file_info/3</a></li> <li title="list_dir-2"><a href="ct_ssh.html#list_dir-2">list_dir/2</a></li> <li title="list_dir-3"><a href="ct_ssh.html#list_dir-3">list_dir/3</a></li> <li title="make_dir-2"><a href="ct_ssh.html#make_dir-2">make_dir/2</a></li> <li title="make_dir-3"><a href="ct_ssh.html#make_dir-3">make_dir/3</a></li> <li title="make_symlink-3"><a href="ct_ssh.html#make_symlink-3">make_symlink/3</a></li> <li title="make_symlink-4"><a href="ct_ssh.html#make_symlink-4">make_symlink/4</a></li> <li title="open-3"><a href="ct_ssh.html#open-3">open/3</a></li> <li title="open-4"><a href="ct_ssh.html#open-4">open/4</a></li> <li title="opendir-2"><a href="ct_ssh.html#opendir-2">opendir/2</a></li> <li title="opendir-3"><a href="ct_ssh.html#opendir-3">opendir/3</a></li> <li title="position-3"><a href="ct_ssh.html#position-3">position/3</a></li> <li title="position-4"><a href="ct_ssh.html#position-4">position/4</a></li> <li title="pread-4"><a href="ct_ssh.html#pread-4">pread/4</a></li> <li title="pread-5"><a href="ct_ssh.html#pread-5">pread/5</a></li> <li title="pwrite-4"><a href="ct_ssh.html#pwrite-4">pwrite/4</a></li> <li title="pwrite-5"><a href="ct_ssh.html#pwrite-5">pwrite/5</a></li> <li title="read-3"><a href="ct_ssh.html#read-3">read/3</a></li> <li title="read-4"><a href="ct_ssh.html#read-4">read/4</a></li> <li title="read_file-2"><a href="ct_ssh.html#read_file-2">read_file/2</a></li> <li title="read_file-3"><a href="ct_ssh.html#read_file-3">read_file/3</a></li> <li title="read_file_info-2"><a href="ct_ssh.html#read_file_info-2">read_file_info/2</a></li> <li title="read_file_info-3"><a href="ct_ssh.html#read_file_info-3">read_file_info/3</a></li> <li title="read_link-2"><a href="ct_ssh.html#read_link-2">read_link/2</a></li> <li title="read_link-3"><a href="ct_ssh.html#read_link-3">read_link/3</a></li> <li title="read_link_info-2"><a href="ct_ssh.html#read_link_info-2">read_link_info/2</a></li> <li title="read_link_info-3"><a href="ct_ssh.html#read_link_info-3">read_link_info/3</a></li> <li title="receive_response-2"><a href="ct_ssh.html#receive_response-2">receive_response/2</a></li> <li title="receive_response-3"><a href="ct_ssh.html#receive_response-3">receive_response/3</a></li> <li title="receive_response-4"><a href="ct_ssh.html#receive_response-4">receive_response/4</a></li> <li title="rename-3"><a href="ct_ssh.html#rename-3">rename/3</a></li> <li title="rename-4"><a href="ct_ssh.html#rename-4">rename/4</a></li> <li title="send-3"><a href="ct_ssh.html#send-3">send/3</a></li> <li title="send-4"><a href="ct_ssh.html#send-4">send/4</a></li> <li title="send-5"><a href="ct_ssh.html#send-5">send/5</a></li> <li title="send_and_receive-3"><a href="ct_ssh.html#send_and_receive-3">send_and_receive/3</a></li> <li title="send_and_receive-4"><a href="ct_ssh.html#send_and_receive-4">send_and_receive/4</a></li> <li title="send_and_receive-5"><a href="ct_ssh.html#send_and_receive-5">send_and_receive/5</a></li> <li title="send_and_receive-6"><a href="ct_ssh.html#send_and_receive-6">send_and_receive/6</a></li> <li title="session_close-2"><a href="ct_ssh.html#session_close-2">session_close/2</a></li> <li title="session_open-1"><a href="ct_ssh.html#session_open-1">session_open/1</a></li> <li title="session_open-2"><a href="ct_ssh.html#session_open-2">session_open/2</a></li> <li title="sftp_connect-1"><a href="ct_ssh.html#sftp_connect-1">sftp_connect/1</a></li> <li title="subsystem-3"><a href="ct_ssh.html#subsystem-3">subsystem/3</a></li> <li title="subsystem-4"><a href="ct_ssh.html#subsystem-4">subsystem/4</a></li> <li title="write-3"><a href="ct_ssh.html#write-3">write/3</a></li> <li title="write-4"><a href="ct_ssh.html#write-4">write/4</a></li> <li title="write_file-3"><a href="ct_ssh.html#write_file-3">write_file/3</a></li> <li title="write_file-4"><a href="ct_ssh.html#write_file-4">write_file/4</a></li> <li title="write_file_info-3"><a href="ct_ssh.html#write_file_info-3">write_file_info/3</a></li> <li title="write_file_info-4"><a href="ct_ssh.html#write_file_info-4">write_file_info/4</a></li> </ul> </li> <li id="no" title="ct_rpc " expanded="false">ct_rpc<ul> <li><a href="ct_rpc.html"> Top of manual page </a></li> <li title="app_node-2"><a href="ct_rpc.html#app_node-2">app_node/2</a></li> <li title="app_node-3"><a href="ct_rpc.html#app_node-3">app_node/3</a></li> <li title="app_node-4"><a href="ct_rpc.html#app_node-4">app_node/4</a></li> <li title="call-4"><a href="ct_rpc.html#call-4">call/4</a></li> <li title="call-5"><a href="ct_rpc.html#call-5">call/5</a></li> <li title="call-6"><a href="ct_rpc.html#call-6">call/6</a></li> <li title="cast-4"><a href="ct_rpc.html#cast-4">cast/4</a></li> <li title="cast-5"><a href="ct_rpc.html#cast-5">cast/5</a></li> </ul> </li> <li id="no" title="ct_snmp " expanded="false">ct_snmp<ul> <li><a href="ct_snmp.html"> Top of manual page </a></li> <li title="get_next_values-3"><a href="ct_snmp.html#get_next_values-3">get_next_values/3</a></li> <li title="get_values-3"><a href="ct_snmp.html#get_values-3">get_values/3</a></li> <li title="load_mibs-1"><a href="ct_snmp.html#load_mibs-1">load_mibs/1</a></li> <li title="register_agents-2"><a href="ct_snmp.html#register_agents-2">register_agents/2</a></li> <li title="register_users-2"><a href="ct_snmp.html#register_users-2">register_users/2</a></li> <li title="register_usm_users-2"><a href="ct_snmp.html#register_usm_users-2">register_usm_users/2</a></li> <li title="set_info-1"><a href="ct_snmp.html#set_info-1">set_info/1</a></li> <li title="set_values-4"><a href="ct_snmp.html#set_values-4">set_values/4</a></li> <li title="start-2"><a href="ct_snmp.html#start-2">start/2</a></li> <li title="start-3"><a href="ct_snmp.html#start-3">start/3</a></li> <li title="stop-1"><a href="ct_snmp.html#stop-1">stop/1</a></li> <li title="unregister_agents-1"><a href="ct_snmp.html#unregister_agents-1">unregister_agents/1</a></li> <li title="unregister_users-1"><a href="ct_snmp.html#unregister_users-1">unregister_users/1</a></li> <li title="update_usm_users-2"><a href="ct_snmp.html#update_usm_users-2">update_usm_users/2</a></li> </ul> </li> <li id="no" title="ct_telnet " expanded="false">ct_telnet<ul> <li><a href="ct_telnet.html"> Top of manual page </a></li> <li title="close-1"><a href="ct_telnet.html#close-1">close/1</a></li> <li title="cmd-2"><a href="ct_telnet.html#cmd-2">cmd/2</a></li> <li title="cmd-3"><a href="ct_telnet.html#cmd-3">cmd/3</a></li> <li title="cmdf-3"><a href="ct_telnet.html#cmdf-3">cmdf/3</a></li> <li title="cmdf-4"><a href="ct_telnet.html#cmdf-4">cmdf/4</a></li> <li title="cont_log-2"><a href="ct_telnet.html#cont_log-2">cont_log/2</a></li> <li title="end_log-0"><a href="ct_telnet.html#end_log-0">end_log/0</a></li> <li title="expect-2"><a href="ct_telnet.html#expect-2">expect/2</a></li> <li title="expect-3"><a href="ct_telnet.html#expect-3">expect/3</a></li> <li title="get_data-1"><a href="ct_telnet.html#get_data-1">get_data/1</a></li> <li title="open-1"><a href="ct_telnet.html#open-1">open/1</a></li> <li title="open-2"><a href="ct_telnet.html#open-2">open/2</a></li> <li title="open-3"><a href="ct_telnet.html#open-3">open/3</a></li> <li title="open-4"><a href="ct_telnet.html#open-4">open/4</a></li> <li title="send-2"><a href="ct_telnet.html#send-2">send/2</a></li> <li title="sendf-3"><a href="ct_telnet.html#sendf-3">sendf/3</a></li> </ul> </li> <li title="unix_telnet"><a href="unix_telnet.html">unix_telnet</a></li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>common_test</h1></center> <h3>MODULE</h3> <div class="REFBODY">common_test</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">A framework for automated testing of arbitrary target nodes</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p>The <strong>Common Test</strong> framework is an environment for implementing and performing automatic and semi-automatic execution of test cases. Common Test uses the OTP Test Server as engine for test case execution and logging.</p> <p>In brief, Common Test supports:</p> <ul> <li>Automated execution of test suites (sets of test cases).</li> <li>Logging of the events during execution.</li> <li>HTML presentation of test suite results.</li> <li>HTML presentation of test suite code.</li> <li>Support functions for test suite authors.</li> <li>Step by step execution of test cases.</li> </ul> <p>The following sections describe the mandatory and optional test suite functions Common Test will call during test execution. For more details see <span class="bold_code"><a href="write_test_chapter.html">Common Test User's Guide.</a></span> </p> </p></div> <h3><a name="id2273419">TEST CASE CALLBACK FUNCTIONS</a></h3> <div class="REFBODY"> <p>The following functions define the callback interface for a test suite.</p> </div> <h3>EXPORTS</h3> <p><a name="Module:all-0"><span class="bold_code">Module:all() -> TestCases | {skip,Reason} </span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">TestCases = [atom() | {group,GroupName}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">GroupName = atom()</span><br> </div> </div> <div class="REFBODY"><p> <p> MANDATORY </p> <p>This function must return the list of all test cases and test case groups in the test suite module that are to be executed. This list also specifies the order the cases and groups will be executed by Common Test. A test case is represented by an atom, the name of the test case function. A test case group is represented by a <span class="code">{group,GroupName}</span> tuple, where <span class="code">GroupName</span>, an atom, is the name of the group (defined with <span class="code">groups/0</span>).</p> <p> If <span class="code">{skip,Reason}</span> is returned, all test cases in the module will be skipped, and the <span class="code">Reason</span> will be printed on the HTML result page.</p> <p>For details on groups, see <span class="bold_code"><a href="write_test_chapter.html#test_case_groups">Test case groups</a></span> in the User's Guide.</p> </p></div> <p><a name="Module:groups-0"><span class="bold_code">Module:groups() -> GroupDefs</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">GroupDefs = [Group]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Group = {GroupName,Properties,GroupsAndTestCases}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">GroupName = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Properties = [parallel | sequence | Shuffle | {RepeatType,N}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">GroupsAndTestCases = [Group | {group,GroupName} | TestCase]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">TestCase = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Shuffle = shuffle | {shuffle,Seed}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Seed = {integer(),integer(),integer()}</span><br> </div> <div class="REFTYPES"> <span class="bold_code">RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | repeat_until_any_ok | repeat_until_any_fail</span><br> </div> <div class="REFTYPES"> <span class="bold_code">N = integer() | forever</span><br> </div> </div> <div class="REFBODY"><p> <p> OPTIONAL </p> <p>See <span class="bold_code"><a href="write_test_chapter.html#test_case_groups">Test case groups</a></span> in the User's Guide for details.</p> </p></div> <p><a name="Module:suite-0"><span class="bold_code">Module:suite() -> [Info] </span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> Info = {timetrap,Time} | {require,Required} | {require,Name,Required} | {userdata,UserData} | {silent_connections,Conns} | {stylesheet,CSSFile}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Time = MilliSec | {seconds,integer()} | {minutes,integer()} | {hours,integer()}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> MilliSec = integer()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Required = Key | {Key,SubKeys}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> SubKeys = SubKey | [SubKey]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> SubKey = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Name = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> UserData = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Conns = [atom()]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> CSSFile = string()</span><br> </div> </div> <div class="REFBODY"><p> <p> OPTIONAL </p> <p>This is the test suite info function. It is supposed to return a list of tagged tuples that specify various properties regarding the execution of this test suite (common for all test cases in the suite).</p> <p>The <span class="code">timetrap</span> tag sets the maximum time each test case is allowed to take (including <span class="code">init_per_testcase/2</span> and <span class="code">end_per_testcase/2</span>). If the timetrap time is exceeded, the test case fails with reason <span class="code">timetrap_timeout</span>.</p> <p>The <span class="code">require</span> tag specifies configuration variables that are required by test cases in the suite. If the required configuration variables are not found in any of the configuration files, all test cases are skipped. For more information about the 'require' functionality, see the reference manual for the function <span class="code">ct:require/[1,2]</span>.</p> <p>With <span class="code">userdata</span>, it is possible for the user to specify arbitrary test suite related information which can be read by calling <span class="code">ct:userdata/2</span>.</p> <p>Other tuples than the ones defined will simply be ignored.</p> <p>For more information about the test suite info function, see <span class="bold_code"><a href="write_test_chapter.html#suite">Test suite info function</a></span> in the User's Guide.</p> </p></div> <p><a name="Module:init_per_suite-1"><span class="bold_code">Module:init_per_suite(Config) -> NewConfig | {skip,Reason} | {skip_and_save,Reason,SaveConfig}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> Config = NewConfig = SaveConfig = [{Key,Value}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Value = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p> OPTIONAL </p> <p>This function is called as the first function in the suite. It typically contains initialization which is common for all test cases in the suite, and which shall only be done once. The <span class="code">Config</span> parameter is the configuration which can be modified here. Whatever is returned from this function is given as <span class="code">Config</span> to all configuration functions and test cases in the suite. If <span class="code">{skip,Reason}</span> is returned, all test cases in the suite will be skipped and <span class="code">Reason</span> printed in the overview log for the suite.</p> <p>For information on <span class="code">save_config</span> and <span class="code">skip_and_save</span>, please see <span class="bold_code"><a href="dependencies_chapter.html#save_config">Dependencies between Test Cases and Suites</a></span> in the User's Guide.</p> </p></div> <p><a name="Module:end_per_suite-1"><span class="bold_code">Module:end_per_suite(Config) -> void() | {save_config,SaveConfig}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> Config = SaveConfig = [{Key,Value}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Value = term()</span><br> </div> </div> <div class="REFBODY"><p> <p> OPTIONAL </p> <p>This function is called as the last test case in the suite. It is meant to be used for cleaning up after <span class="code">init_per_suite/1</span>. For information on <span class="code">save_config</span>, please see <span class="bold_code"><a href="dependencies_chapter.html#save_config">Dependencies between Test Cases and Suites</a></span> in the User's Guide.</p> </p></div> <p><a name="Module:init_per_group-2"><span class="bold_code">Module:init_per_group(GroupName, Config) -> NewConfig | {skip,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> GroupName = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Config = NewConfig = [{Key,Value}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Value = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p> MANDATORY (only if one or more groups are defined) </p> <p>This function is called before execution of a test case group. It typically contains initialization which is common for all test cases in the group, and which shall only be performed once. <span class="code">GroupName</span> is the name of the group, as specified in the group definition (see <span class="code">groups/0</span>). The <span class="code">Config</span> parameter is the configuration which can be modified here. Whatever is returned from this function is given as <span class="code">Config</span> to all test cases in the group. If <span class="code">{skip,Reason}</span> is returned, all test cases in the group will be skipped and <span class="code">Reason</span> printed in the overview log for the group.</p> <p>For information about test case groups, please see <span class="bold_code"><a href="write_test_chapter.html#test_case_groups">Test case groups</a></span> chapter in the User's Guide.</p> </p></div> <p><a name="Module:end_per_group-2"><span class="bold_code">Module:end_per_group(GroupName, Config) -> void() | {return_group_result,Status}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> GroupName = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Config = [{Key,Value}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Value = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Status = ok | skipped | failed</span><br> </div> </div> <div class="REFBODY"><p> <p> MANDATORY (only if one or more groups are defined) </p> <p>This function is called after the execution of a test case group is finished. It is meant to be used for cleaning up after <span class="code">init_per_group/2</span>. By means of <span class="code">{return_group_result,Status}</span>, it is possible to return a status value for a nested sub-group. The status can be retrieved in <span class="code">end_per_group/2</span> for the group on the level above. The status will also be used by Common Test for deciding if execution of a group should proceed in case the property <span class="code">sequence</span> or <span class="code">repeat_until_*</span> is set.</p> <p>For more information about test case groups, please see <span class="bold_code"><a href="write_test_chapter.html#test_case_groups">Test case groups</a></span> chapter in the User's Guide.</p> </p></div> <p><a name="Module:init_per_testcase-2"><span class="bold_code">Module:init_per_testcase(TestCase, Config) -> NewConfig | {skip,Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> TestCase = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Config = NewConfig = [{Key,Value}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Value = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>OPTIONAL</p> <p>This function is called before each test case. The <span class="code">TestCase</span> argument is the name of the test case, and <span class="code">Config</span> is the configuration which can be modified here. Whatever is returned from this function is given as <span class="code">Config</span> to the test case. If <span class="code">{skip,Reason}</span> is returned, the test case will be skipped and <span class="code">Reason</span> printed in the overview log for the suite.</p> </p></div> <p><a name="Module:end_per_testcase-2"><span class="bold_code">Module:end_per_testcase(TestCase, Config) -> void() | {fail,Reason} | {save_config,SaveConfig}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> TestCase = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Config = SaveConfig = [{Key,Value}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Value = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p> OPTIONAL </p> <p> This function is called after each test case, and can be used to clean up after <span class="code">init_per_testcase/2</span> and the test case. Any return value (besides <span class="code">{fail,Reason}</span> and <span class="code">{save_config,SaveConfig}</span>) is ignored. By returning <span class="code">{fail,Reason}</span>, <span class="code">TestCase</span> will be marked as failed (even though it was actually successful in the sense that it returned a value instead of terminating). For information on <span class="code">save_config</span>, please see <span class="bold_code"><a href="dependencies_chapter.html#save_config">Dependencies between Test Cases and Suites</a></span> in the User's Guide</p> </p></div> <p><a name="Module:testcase-0"><span class="bold_code">Module:testcase() -> [Info] </span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> Info = {timetrap,Time} | {require,Required} | {require,Name,Required} | {userdata,UserData} | {silent_connections,Conns}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Time = MilliSec | {seconds,integer()} | {minutes,integer()} | {hours,integer()}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> MilliSec = integer()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Required = Key | {Key,SubKeys}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> SubKeys = SubKey | [SubKey]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> SubKey = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Name = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> UserData = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Conns = [atom()]</span><br> </div> </div> <div class="REFBODY"><p> <p>OPTIONAL</p> <p>This is the test case info function. It is supposed to return a list of tagged tuples that specify various properties regarding the execution of this particular test case.</p> <p>The <span class="code">timetrap</span> tag sets the maximum time the test case is allowed to take. If the timetrap time is exceeded, the test case fails with reason <span class="code">timetrap_timeout</span>. <span class="code">init_per_testcase/2</span> and <span class="code">end_per_testcase/2</span> are included in the timetrap time.</p> <p>The <span class="code">require</span> tag specifies configuration variables that are required by the test case. If the required configuration variables are not found in any of the configuration files, the test case is skipped. For more information about the 'require' functionality, see the reference manual for the function <span class="code">ct:require/[1,2]</span>.</p> <p>If <span class="code">timetrap</span> and/or <span class="code">require</span> is not set, the default values specified in the <span class="code">suite/0</span> return list will be used.</p> <p>With <span class="code">userdata</span>, it is possible for the user to specify arbitrary test case related information which can be read by calling <span class="code">ct:userdata/3</span>.</p> <p>Other tuples than the ones defined will simply be ignored.</p> <p>For more information about the test case info function, see <span class="bold_code"><a href="write_test_chapter.html#info_function">Test case info function</a></span> in the User's Guide.</p> </p></div> <p><a name="Module:testcase-1"><span class="bold_code">Module:testcase(Config) -> void() | {skip,Reason} | {comment,Comment} | {save_config,SaveConfig} | {skip_and_save,Reason,SaveConfig} | exit() </span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code"> Config = SaveConfig = [{Key,Value}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Value = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Reason = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Comment = string()</span><br> </div> </div> <div class="REFBODY"><p> <p> MANDATORY </p> <p>This is the implementation of a test case. Here you must call the functions you want to test, and do whatever you need to check the result. If something fails, make sure the function causes a runtime error, or call <span class="code">ct:fail/[0,1]</span> (which also causes the test case process to crash).</p> <p>Elements from the <span class="code">Config</span> parameter can be read with the <span class="code">?config</span> macro. The <span class="code">config</span> macro is defined in <span class="code">ct.hrl</span></p> <p>You can return <span class="code">{skip,Reason}</span> if you decide not to run the test case after all. <span class="code">Reason</span> will then be printed in 'Comment' field on the HTML result page.</p> <p>You can return <span class="code">{comment,Comment}</span> if you wish to print some information in the 'Comment' field on the HTML result page.</p> <p>If the function returns anything else, the test case is considered successful. (The return value always gets printed in the test case log file).</p> <p>For more information about test case implementation, please see <span class="bold_code"><a href="write_test_chapter.html#test_cases">Test cases</a></span> in the User's Guide.</p> <p>For information on <span class="code">save_config</span> and <span class="code">skip_and_save</span>, please see <span class="bold_code"><a href="dependencies_chapter.html#save_config">Dependencies between Test Cases and Suites</a></span> in the User's Guide.</p> </p></div> </div> <div class="footer"> <hr> <p>Copyright © 2003-2010 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>