<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2010</year><year>2023</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>ct</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev>A</rev>
    <file>ct.xml</file>
  </header>
  <module since="">ct</module>
  <modulesummary>Main user interface for the Common Test framework.</modulesummary>

  <description>

     <p>Main user interface for the <c>Common Test</c> framework.</p>

     <p>This module implements the command-line interface for running
       tests and basic functions for <c>Common Test</c> case issues, such as
       configuration and logging.</p>

     <p>The framework stores configuration values in a property list usually named
       <c>Config</c>. The list contains information about the test run added by the
       framework itself and may also contain user-provided values. The configuration
       is passed into individual test cases as well as support functions if defined.</p>

    <p>Possible configuration variables include:</p>

    <list type="bulleted">
      <item><p><c>data_dir</c> - Data file directory</p></item>
      <item><p><c>priv_dir</c> - Scratch file directory</p></item>
      <item><p>Whatever added by
      <seemfa marker="ct_suite#Module:init_per_suite/1"><c>init_per_suite/1</c></seemfa>
      or
      <seemfa marker="ct_suite#Module:init_per_testcase/2"><c>init_per_testcase/2</c></seemfa>
      in the test suite.</p></item>
    </list>

    <warning><p>The <c>?config</c> macro, used to receive individual config values from
      the <c>Config</c> property list, is deprecated. Please use
      <c>proplists:get_value/2-3</c> instead.</p></warning>

  </description>

  <datatypes>
    <datatype>
      <name name="handle" />
      <desc>
        <p>The identity (handle) of a connection.</p>
      </desc>
    </datatype>

    <datatype>
      <name name="config_key" />
      <desc>
	<p>A configuration key which exists in a configuration file</p>
      </desc>
    </datatype>
    <datatype>
      <name name="target_name" />
      <desc>
        <p>A name and association to configuration data introduced
        through a require statement, or a call to
        <seemfa marker="#require/2"><c>ct:require/2</c></seemfa>,
        for example,
        <c>ct:require(mynodename,{node,[telnet]})</c>.</p>
      </desc>
    </datatype>
    <datatype>
      <name name="key_or_name" />
      <desc></desc>
    </datatype>
    <datatype>
      <name name="conn_log_options" />
      <desc>
	<p>Options that can be given to the <c>cth_conn_log</c> hook,
	which is used for logging of NETCONF and Telnet
	connections. See
	<seeerl marker="ct_netconfc#Logging">ct_netconfc</seeerl>
	or <seeerl marker="ct_telnet#Logging">ct_telnet</seeerl>
	for description and examples of how to use this hook.</p>
      </desc>
    </datatype>

    <datatype>
      <name name="conn_log_option" />
      <desc></desc>
    </datatype>
    <datatype>
      <name name="conn_log_type" />
      <desc></desc>
    </datatype>
    <datatype>
      <name name="conn_log_mod" />
      <desc></desc>
    </datatype>

  </datatypes>

  <funcs>
    <func>
      <name since="" name="abort_current_testcase" arity="1" />
      <fsummary>Aborts the currently executing test case.</fsummary>
      <desc><marker id="abort_current_testcase-1"/>
        <p>Aborts the currently executing test case. The user must know with
          certainty which test case is currently executing. The function is
          therefore only safe to call from a function that has been called
          (or synchronously invoked) by the test case.</p>

        <p><c>Reason</c>, the reason for aborting the test case, is printed
          in the test case log.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B" name="add_config" arity="2" />
      <fsummary>Loads configuration variables using the specified callback
        module and configuration string.</fsummary>
      <desc><marker id="add_config-2"/>
        <p>Loads configuration variables using the specified callback module and
          configuration string. The callback module is to be either loaded or
          present in the code path. Loaded configuration variables can later
          be removed using function
          <seemfa marker="#remove_config/2"><c>ct:remove_config/2</c></seemfa>.
        </p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="break" arity="1" />
      <fsummary>Cancels any active timetrap and pause the execution of the
        current test case until the user calls function continue/0.</fsummary>
      <desc><marker id="break-1"/>
        <p>Cancels any active timetrap and pauses the execution of the
          current test case until the user calls function <c>continue/0</c>.
          The user can then interact with the Erlang node running the tests,
          for example, for debugging purposes or for manually executing a
          part of the test case. If a parallel group is executing,
          <seemfa marker="#break/2"><c>ct:break/2</c></seemfa> is to be
          called instead.</p>
       <p>A cancelled timetrap is not automatically reactivated after the
         break, but must be started explicitly with
         <seemfa marker="#timetrap/1"><c>ct:timetrap/1</c></seemfa>.</p>
       <p>In order for the break/continue functionality to work, <c>Common
         Test</c> must release the shell process controlling <c>stdin</c>.
         This is done by setting start option <c>release_shell</c>
         to <c>true</c>. For details, see section
         <seeguide marker="run_test_chapter#erlang_shell_or_program">Running
         Tests from the Erlang Shell or from an Erlang Program</seeguide>
         in the User's Guide.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="break" arity="2" />
      <fsummary>Works the same way as break/1, only argument TestCase makes it
        possible to pause a test case executing in a parallel group.</fsummary>
      <desc><marker id="break-2"/>
        <p>Works the same way as
          <seemfa marker="#break/1"><c>ct:break/1</c></seemfa>, only
          argument <c>TestCase</c> makes it possible to pause a test case
          executing in a parallel group. Function
          <seemfa marker="#continue/1"><c>ct:continue/1</c></seemfa> is to
          be used to resume execution of <c>TestCase</c>.</p>

        <p>For details, see
          <seemfa marker="#break/1"><c>ct:break/1</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B" name="capture_get" arity="0" />
      <fsummary>Equivalent to capture_get([default]).</fsummary>
      <desc><marker id="capture_get-0"/>
        <p>Equivalent to
          <seemfa marker="#capture_get/1">ct:capture_get([default])</seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B" name="capture_get" arity="1" />
      <fsummary>Returns and purges the list of text strings buffered during
        the latest session of capturing printouts to stdout.</fsummary>
      <desc><marker id="capture_get-1"/>
        <p>Returns and purges the list of text strings buffered during the
          latest session of capturing printouts to <c>stdout</c>. Log
          categories that are to be ignored in <c>ListOfStrings</c> can be
          specified with <c>ExclCategories</c>.
          If <c>ExclCategories = []</c>, no filtering takes place.</p>

        <p>See also
          <seemfa marker="#capture_start/0"><c>ct:capture_start/0</c></seemfa>,
          <seemfa marker="#capture_stop/0"><c>ct:capture_stop/0</c></seemfa>,
          <seemfa marker="#log/3"><c>ct:log/3</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B" name="capture_start" arity="0" />
      <fsummary>Starts capturing all text strings printed to stdout
        during execution of the test case.</fsummary>
        <desc><marker id="capture_start-0"/>
        <p>Starts capturing all text strings printed to <c>stdout</c>
          during execution of the test case.</p>

        <p>See also
          <seemfa marker="#capture_get/1"><c>ct:capture_get/1</c></seemfa>,
          <seemfa marker="#capture_stop/0"><c>ct:capture_stop/0</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B" name="capture_stop" arity="0" />
      <fsummary>Stops capturing text strings (a session started with
        capture_start/0).</fsummary>
      <desc><marker id="capture_stop-0"/>
        <p>Stops capturing text strings (a session started with
          <c>capture_start/0</c>).</p>

        <p>See also
          <seemfa marker="#capture_get/1"><c>ct:capture_get/1</c></seemfa>,
          <seemfa marker="#capture_start/0"><c>ct:capture_start/0</c></seemfa>.</p>
       </desc>
    </func>

    <func>
      <name since="" name="comment" arity="1" />
      <fsummary>Prints the specified Comment in the comment field in the
        table on the test suite result page.</fsummary>
      <desc><marker id="comment-1"/>
        <p>Prints the specified <c>Comment</c> in the comment field in the
          table on the test suite result page.</p>

        <p>If called several times, only the last comment is printed. The
          test case return value <c>{comment,Comment}</c> overwrites the
          string set by this function.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B" name="comment" arity="2" />
      <fsummary>Prints the formatted string in the comment field in the
        table on the test suite result page.</fsummary>
      <desc><marker id="comment-2"/>
        <p>Prints the formatted string in the comment field in the table
          on the test suite result page.</p>

        <p>Arguments <c>Format</c> and <c>Args</c> are used in a call to
          <c>io_lib:format/2</c> to create the comment string. The behavior
          of <c>comment/2</c> is otherwise the same as function
          <seemfa marker="#comment/1"><c>ct:comment/1</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="continue" arity="0" />
      <fsummary>This function must be called to continue after a test
        case (not executing in a parallel group) has called break/1.</fsummary>
      <desc><marker id="continue-0"/>
        <p>This function must be called to continue after a test case
          (not executing in a parallel group) has called function
          <seemfa marker="#break/1"><c>ct:break/1</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="continue" arity="1" />
      <fsummary>This function must be called to continue after a test case
        has called break/2.</fsummary>
      <desc><marker id="continue-1"/>
        <p>This function must be called to continue after a test case has
          called <seemfa marker="#break/2"><c>ct:break/2</c></seemfa>.
          If the paused test case, <c>TestCase</c>, executes in a parallel
          group, this function, rather than <c>continue/0</c>, must be used
          to let the test case proceed.</p>
      </desc>
    </func>

    <func>
      <name since="" name="decrypt_config_file" arity="2" />
      <fsummary>Decrypts EncryptFileName, previously generated with
        encrypt_config_file/2,3.</fsummary>
      <desc><marker id="decrypt_config_file-2"/>
        <p>Decrypts <c>EncryptFileName</c>, previously generated with
          <seemfa marker="#encrypt_config_file/2"><c>ct:encrypt_config_file/2,3</c></seemfa>.
          The original file contents is saved in the target file. The
          encryption key, a string, must be available in a text file named
          <c>.ct_config.crypt</c>, either in the current directory, or the
          home directory of the user (it is searched for in that order).</p>
      </desc>
    </func>

    <func>
      <name since="" name="decrypt_config_file" arity="3" />
      <fsummary>Decrypts EncryptFileName, previously generated with
        encrypt_config_file/2,3.</fsummary>
      <desc><marker id="decrypt_config_file-3"/>
        <p>Decrypts <c>EncryptFileName</c>, previously generated with
          <seemfa marker="#encrypt_config_file/2"><c>ct:encrypt_config_file/2,3</c></seemfa>.
          The original file contents is saved in the target file. The key
          must have the same value as that used for encryption.</p>
      </desc>
    </func>

    <func>
      <name since="" name="encrypt_config_file" arity="2" />
      <fsummary>Encrypts the source configuration file with DES3 and saves the
        result in file EncryptFileName.</fsummary>
      <desc><marker id="encrypt_config_file-2"/>
        <p>Encrypts the source configuration file with DES3 and saves the result
          in file <c>EncryptFileName</c>. The key, a string, must be
          available in a text file named <c>.ct_config.crypt</c>, either
          in the current directory, or the home directory of the user (it
          is searched for in that order).</p>

        <p>For information about using encrypted configuration files when
          running tests, see section
          <seeguide marker="config_file_chapter#encrypted_config_files">Encrypted
          Configuration Files</seeguide> in the User's Guide.</p>

        <p>For details on DES3 encryption/decryption, see application
          <seeapp marker="crypto:index"><c>Crypto</c></seeapp>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="encrypt_config_file" arity="3" />
      <fsummary>Encrypts the source configuration file with DES3 and saves the
       result in the target file EncryptFileName.</fsummary>
      <desc><marker id="encrypt_config_file-3"/>
        <p>Encrypts the source configuration file with DES3 and saves the result
          in the target file <c>EncryptFileName</c>. The encryption key
          to use is either the value in <c>{key,Key}</c> or the value
          stored in the file specified by <c>{file,File}</c>.</p>

        <p>For information about using encrypted configuration files when
          running tests, see section
          <seeguide marker="config_file_chapter#encrypted_config_files">Encrypted
          Configuration Files</seeguide> in the User's Guide.</p>

        <p>For details on DES3 encryption/decryption, see application
          <seeapp marker="crypto:index"><c>Crypto</c></seeapp>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="fail" arity="1" />
      <fsummary>Terminates a test case with the specified error
        Reason.</fsummary>
      <desc><marker id="fail-1"/>
        <p>Terminates a test case with the specified error <c>Reason</c>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B" name="fail" arity="2" />
      <fsummary>Terminates a test case with an error message specified by
        a format string and a list of values (used as arguments to
        io_lib:format/2).</fsummary>
      <desc><marker id="fail-2"/>
        <p>Terminates a test case with an error message specified by a
          format string and a list of values (used as arguments to
          <c>io_lib:format/2</c>).</p>
      </desc>
    </func>

    <func>
      <name since="" name="get_config" arity="1" />
      <fsummary>Equivalent to get_config(Required, undefined, []).</fsummary>
      <desc><marker id="get_config-1"/>
        <p>Equivalent to <seemfa marker="#get_config/3"><c>ct:get_config(Required,
          undefined, [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="get_config" arity="2" />
      <fsummary>Equivalent to get_config(Required, Default, []).</fsummary>
      <desc><marker id="get_config-2"/>
        <p>Equivalent to <seemfa marker="#get_config/3"><c>ct:get_config(Required,
          Default, [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="get_config" arity="3" />
      <fsummary>Reads configuration data values.</fsummary>
      <desc><marker id="get_config-3"/>
        <p>Reads configuration data values.</p>

        <p>Returns the matching values or configuration elements, given a
          configuration variable key or its associated name (if one has been
          specified with
          <seemfa marker="#require/2"><c>ct:require/2</c></seemfa>
          or a <c>require</c> statement).</p>

        <p><em>Example:</em></p>

        <p>Given the following configuration file:</p>

        <pre>
 {unix,[{telnet,IpAddr},
        {user,[{username,Username},
               {password,Password}]}]}.</pre>

        <p>Then:</p>

        <pre>
 ct:get_config(unix,Default) -&gt; [{telnet,IpAddr}, 
  {user, [{username,Username}, {password,Password}]}]
 ct:get_config({unix,telnet},Default) -&gt; IpAddr
 ct:get_config({unix,user,username},Default) -&gt; Username
 ct:get_config({unix,ftp},Default) -&gt; Default
 ct:get_config(unknownkey,Default) -&gt; Default</pre>

        <p>If a configuration variable key has been associated with a name (by
          <seemfa marker="#require/2"><c>ct:require/2</c></seemfa>
          or a <c>require</c> statement), the name can be used instead
          of the key to read the value:</p>

        <pre>
 ct:require(myuser,{unix,user}) -&gt; ok.
 ct:get_config(myuser,Default) -&gt; [{username,Username}, {password,Password}]</pre>
  
        <p>If a configuration variable is defined in multiple files, use option
         <c>all</c> to access all possible values. The values are returned
          in a list. The order of the elements corresponds to the order
          that the configuration files were specified at startup.</p>

        <p>If configuration elements (key-value tuples) are to be returned as
          result instead of values, use option <c>element</c>. The
          returned elements are then on the form <c>{Required,Value}</c>.</p>

        <p>See also
          <seemfa marker="#get_config/1"><c>ct:get_config/1</c></seemfa>,
          <seemfa marker="#get_config/2"><c>ct:get_config/2</c></seemfa>,
          <seemfa marker="#require/1"><c>ct:require/1</c></seemfa>,
          <seemfa marker="#require/2"><c>ct:require/2</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 17.5" name="get_event_mgr_ref" arity="0" />
      <fsummary>Gets a reference to the <c>Common Test</c> event manager.</fsummary>
        <desc><marker id="get_event_mgr_ref-0"/>
          <p>Gets a reference to the <c>Common Test</c> event manager.
            The reference can be used to, for example, add a user-specific
            event handler while tests are running.</p>

          <p><em>Example:</em></p>

          <pre>
 gen_event:add_handler(ct:get_event_mgr_ref(), my_ev_h, [])</pre>
      </desc>
    </func>

    <func>
      <name since="OTP 21.0" name="get_progname" arity="0" />
      <fsummary>Returns the command used to start this Erlang instance.</fsummary>
      <desc><marker id="get_progname-0"/>
        <p>Returns the command used to start this Erlang instance.
           If this information could not be found, the string
           <c>"no_prog_name"</c> is returned.</p>
      </desc>
    </func>

    <func>
      <name since="" name="get_status" arity="0" />
      <fsummary>Returns status of ongoing test.</fsummary>
      <desc><marker id="get_status-0"/>
        <p>Returns status of ongoing test. The returned list contains
          information about which test case is executing (a list of cases
          when a parallel test case group is executing), as well as
          counters for successful, failed, skipped, and total test cases
          so far.</p>
      </desc>
    </func>

    <func>
      <name since="" name="get_target_name" arity="1" />
      <fsummary>Returns the name of the target that the specified connection
        belongs to.</fsummary>
      <desc><marker id="get_target_name-1"/>
        <p>Returns the name of the target that the specified connection
          belongs to.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 18.0" name="get_testspec_terms" arity="0" />
      <fsummary>Gets a list of all test specification terms used to
        configure and run this test.</fsummary>
      <desc><marker id="get_testspec_terms-0"/>
        <p>Gets a list of all test specification terms used to configure
          and run this test.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 18.0" name="get_testspec_terms" arity="1" />
      <fsummary>Reads one or more terms from the test specification used to
        configure and run this test.</fsummary>
      <desc><marker id="get_testspec_terms-1"/>
        <p>Reads one or more terms from the test specification used to
          configure and run this test. <c>Tag</c> is any valid test
          specification tag, for example, <c>label</c>, <c>config</c>, or
          <c>logdir</c>. User-specific terms are also available to read if
          option <c>allow_user_terms</c> is set.</p>
        <p>All value tuples returned, except user terms, have the node
          name as first element.</p>
        <p>To read test terms, use <c>Tag = tests</c> (rather than
          <c>suites</c>, <c>groups</c>, or <c>cases</c>). <c>Value</c> is
          then the list of <em>all</em> tests on the form
          <c>[{Node,Dir,[{TestSpec,GroupsAndCases1},...]},...]</c>, where
          <c>GroupsAndCases = [{Group,[Case]}] | [Case]</c>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B" name="get_timetrap_info" arity="0" />
      <fsummary>Reads information about the timetrap set for the current
        test case.</fsummary>
     <desc><marker id="get_timetrap_info-0"/>
        <p>Reads information about the timetrap set for the current test
          case. <c>Scaling</c> indicates if <c>Common Test</c> will attempt
          to compensate timetraps automatically for runtime delays
          introduced by, for example, tools like cover. <c>ScaleVal</c> is
	  the value of the current scaling multiplier (always 1 if scaling is
	  disabled). Note the <c>Time</c> is not the scaled result.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 19.1" name="get_verbosity" arity="1" />
      <fsummary>Read the verbosity level for a logging category.</fsummary>
      <desc><marker id="get_verbosity-1"/>
        <p>This function returns the verbosity level for the specified logging
	category. See the <seeguide marker="write_test_chapter#logging">
	User's Guide</seeguide> for details. Use the value <c>default</c> to read
	the general verbosity level.</p>
      </desc>
    </func>

    <func>
      <name since="" name="install" arity="1" />
      <fsummary>Installs configuration files and event handlers.</fsummary>
      <desc><marker id="install-1"/>
        <p>Installs configuration files and event handlers.</p>

        <p>Run this function once before the first test.</p>

        <p><em>Example:</em></p>

        <pre>
 install([{config,["config_node.ctc","config_user.ctc"]}])</pre>

        <p>This function is automatically run by program <c>ct_run</c>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="listenv" arity="1" />
      <fsummary>Performs command listenv on the specified Telnet connection
        and returns the result as a list of key-value pairs.</fsummary>
      <desc><marker id="listenv-1"/>
        <p>Performs command <c>listenv</c> on the specified Telnet connection
          and returns the result as a list of key-value pairs.</p>
      </desc>
    </func>

    <func>
      <name since="" name="log" arity="1" />
      <fsummary>Equivalent to log(default, 50, Format, [], []).</fsummary>
      <desc><marker id="log-1"/>
        <p>Equivalent to
          <seemfa marker="#log/5"><c>ct:log(default, 50, Format, [], [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="log" arity="2" />
      <fsummary>Equivalent to log(Category, Importance, Format,
        FormatArgs, []).</fsummary>
      <desc><marker id="log-2"/>
        <p>Equivalent to <seemfa marker="#log/5"><c>ct:log(Category,
          Importance, Format, FormatArgs, [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="log" arity="3" />
      <fsummary>Equivalent to log(Category, Importance, Format,
        FormatArgs, Opts).</fsummary>
      <desc><marker id="log-3"/>
        <p>Equivalent to <seemfa marker="#log/5"><c>ct:log(Category,
          Importance, Format, FormatArgs, Opts)</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="log" arity="4" />
      <fsummary>Equivalent to log(Category, Importance, Format,
        FormatArgs, Opts).</fsummary>
      <desc><marker id="log-4"/>
        <p>Equivalent to <seemfa marker="#log/5"><c>ct:log(Category,
          Importance, Format, FormatArgs, Opts)</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 18.3" name="log" arity="5" />
      <fsummary>Prints from a test case to the log file.</fsummary>
      <desc><marker id="log-5"/>
        <p>Prints from a test case to the log file.</p>

        <p>This function is meant for printing a string directly from a
          test case to the test case log file.</p>

        <p>Default <c>Category</c> is <c>default</c>,
          default <c>Importance</c> is <c>?STD_IMPORTANCE</c>,
          and default value for <c>FormatArgs</c> is <c>[]</c>.</p>

        <p>For details on <c>Category</c>, <c>Importance</c> and the <c>no_css</c>
	option, see section <seeguide marker="write_test_chapter#logging">
	Logging - Categories and Verbosity Levels</seeguide> in the User's Guide.</p>

	<p>Common Test will not escape special HTML characters (&lt;, &gt; and &amp;)
	   in the text printed with this function, unless the <c>esc_chars</c>
	   option is used.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B01" name="make_priv_dir" arity="0" />
      <fsummary>If the test has been started with option create_priv_dir
        set to manual_per_tc, in order for the test case to use the private
        directory, it must first create it by calling this function.</fsummary>
      <desc><marker id="make_priv_dir-0"/>
        <p>If the test is started with option <c>create_priv_dir</c>
          set to <c>manual_per_tc</c>, in order for the test case to use
          the private directory, it must first create it by calling this
          function.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="notify" arity="2" />
      <fsummary>Sends an asynchronous notification of type Name with Data
        to the <c>Common Test</c> event manager.</fsummary>
      <desc><marker id="notify-2"/>
        <p>Sends an asynchronous notification of type <c>Name</c> with
          <c>Data</c>to the Common Test event manager. This can later be
          caught by any installed event manager.</p>

        <p>See also
          <seeerl marker="stdlib:gen_event"><c>gen_event(3)</c></seeerl>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="pal" arity="1" />
      <fsummary>Equivalent to pal(default, 50, Format, [], []).</fsummary>
      <desc><marker id="pal-1"/>
        <p>Equivalent to
          <seemfa marker="#pal/5"><c>ct:pal(default, 50, Format,
            [], [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="pal" arity="2" />
      <fsummary>Equivalent to pal(Category, Importance, Format,
        FormatArgs, []).</fsummary>
      <desc><marker id="pal-2"/>
        <p>Equivalent to <seemfa marker="#pal/5"><c>ct:pal(Category,
          Importance, Format, FormatArgs, [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="pal" arity="3" />
      <fsummary>Equivalent to pal(Category, Importance, Format,
        FormatArgs, Opts).</fsummary>
      <desc><marker id="pal-3"/>
        <p>Equivalent to <seemfa marker="#pal/5"><c>ct:pal(Category,
          Importance, Format, FormatArgs, Opts)</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="pal" arity="4" />
      <fsummary>Equivalent to pal(Category, Importance, Format,
        FormatArgs, Opts).</fsummary>
      <desc><marker id="pal-4"/>
        <p>Equivalent to <seemfa marker="#pal/5"><c>ct:pal(Category,
          Importance, Format, FormatArgs, Opts)</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 19.2" name="pal" arity="5" />
      <fsummary>Prints and logs from a test case.</fsummary>
      <desc><marker id="pal-5"/>
        <p>Prints and logs from a test case.</p>

        <p>This function is meant for printing a string from a test case,
          both to the test case log file and to the console.</p>

        <p>Default <c>Category</c> is <c>default</c>,
          default <c>Importance</c> is <c>?STD_IMPORTANCE</c>,
          and default value for <c>FormatArgs</c> is <c>[]</c>.</p>

        <p>For details on <c>Category</c> and <c>Importance</c>, see section
          <seeguide marker="write_test_chapter#logging">Logging - Categories
          and Verbosity Levels</seeguide> in the User's Guide.</p>

	<p>Note that special characters in the text (&lt;, &gt; and &amp;) will
	   be escaped by Common Test before the text is printed to the log
	   file.</p>
      </desc>
    </func>

    <func>
      <name since="" name="parse_table" arity="1" />
      <fsummary>Parses the printout from an SQL table and returns a list of
        tuples.</fsummary>
      <desc><marker id="parse_table-1"/>
        <p>Parses the printout from an SQL table and returns a list of
          tuples.</p>

        <p>The printout to parse is typically the result of a <c>select</c>
          command in SQL. The returned <c>Table</c> is a list of tuples,
          where each tuple is a row in the table.</p>

        <p><c>Heading</c> is a tuple of strings representing the headings
          of each column in the table.</p>
      </desc>
    </func>

    <func>
      <name since="" name="print" arity="1" />
      <fsummary>Equivalent to print(default, 50, Format, [], []).</fsummary>
      <desc><marker id="print-1"/>
        <p>Equivalent to <seemfa marker="#print/5"><c>ct:print(default,
        50, Format, [], [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="print" arity="2" />
      <fsummary>Equivalent to print(Category, Importance, Format,
        FormatArgs, []).</fsummary>
      <desc><marker id="print-2"/>
        <p>Equivalent to <seemfa marker="#print/5"><c>ct:print(Category,
          Importance, Format, FormatArgs, [])</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="print" arity="3" />
      <fsummary>Equivalent to print(Category, Importance, Format,
        FormatArgs, Opts).</fsummary>
      <desc><marker id="print-3"/>
        <p>Equivalent to <seemfa marker="#print/5"><c>ct:print(Category,
          Importance, Format, FormatArgs, Opts)</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="print" arity="4" />
      <fsummary>Equivalent to print(Category, Importance, Format,
        FormatArgs, Opts).</fsummary>
      <desc><marker id="print-4"/>
        <p>Equivalent to <seemfa marker="#print/5"><c>ct:print(Category,
          Importance, Format, FormatArgs, Opts)</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 19.2" name="print" arity="5" />
      <fsummary>Prints from a test case to the console.</fsummary>
      <desc><marker id="print-5"/>
        <p>Prints from a test case to the console.</p>

        <p>This function is meant for printing a string from a test case to
          the console.</p>

        <p>Default <c>Category</c> is <c>default</c>,
          default <c>Importance</c> is <c>?STD_IMPORTANCE</c>,
          and default value for <c>FormatArgs</c> is <c>[]</c>.</p>

        <p>For details on <c>Category</c> and <c>Importance</c>, see section
          <seeguide marker="write_test_chapter#logging">Logging - Categories
          and Verbosity Levels</seeguide> in the User's Guide.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B" name="reload_config" arity="1" />
      <fsummary>Reloads configuration file containing specified configuration
        key.</fsummary>
      <desc><marker id="reload_config-1"/>
        <p>Reloads configuration file containing specified configuration key.</p>

        <p>This function updates the configuration data from which the
          specified configuration variable was read, and returns the (possibly)
          new value of this variable.</p>

        <p>If some variables were present in the configuration, but are
          not loaded using this function, they are removed from the
          configuration table together with their aliases.</p>
      </desc>
    </func>

     <func>
      <name since="OTP 20.2" name="remaining_test_procs" arity="0" />
      <fsummary>>This function will return the identity of test- and group
       leader processes that are still running at the time of this call.</fsummary>
      <desc><marker id="remaining_test_procs-0"/>
        <p>This function will return the identity of test- and group
	leader processes that are still running at the time of this call.
	<c>TestProcs</c> are processes in the system that have a Common Test IO
	process as group leader. <c>SharedGL</c> is the central Common Test
	IO process, responsible for printing to log files for configuration
	functions and sequentially executing test cases. <c>OtherGLs</c> are
	Common Test IO processes that print to log files for test cases
	in parallel test case groups.</p>
	<p>The process information returned by this function may be
	used to locate and terminate remaining processes after tests have
	finished executing. The function would typically by called from
	Common Test Hook functions.</p>
	<p>Note that processes that execute configuration functions or
	test cases are never included in <c>TestProcs</c>. It is therefore safe
	to use post configuration hook functions (such as post_end_per_suite,
	post_end_per_group, post_end_per_testcase) to terminate all processes
	in <c>TestProcs</c> that have the current group leader process as its group
	leader.</p>
	<p>Note also that the shared group leader (<c>SharedGL</c>) must never be
	terminated by the user, only by Common Test. Group leader processes
	for parallel test case groups (<c>OtherGLs</c>) may however be terminated
	in post_end_per_group hook functions.</p>
      </desc>
    </func>   

    <func>
      <name since="OTP R14B" name="remove_config" arity="2" />
      <fsummary>Removes configuration variables (together with
        their aliases) that were loaded with specified callback module and
        configuration string.</fsummary>
      <desc><marker id="remove_config-2"/>
        <p>Removes configuration variables (together with their aliases)
          that were loaded with specified callback module and configuration
          string.</p>
      </desc>
    </func>

    <func>
      <name since="" name="require" arity="1" />
      <fsummary>Checks if the required configuration is available.</fsummary>
      <desc><marker id="require-1"/>
        <p>Checks if the required configuration is available. Arbitrarily
          deep tuples can be specified as <c>Required</c>. Only the last
          element of the tuple can be a list of <c>SubKey</c>s.</p>

        <p><em>Example 1.</em> Require the variable <c>myvar</c>:</p>

        <pre>
 ok = ct:require(myvar).</pre>
 
        <p>In this case the configuration file must at least contain:</p>

        <pre>
 {myvar,Value}.</pre>
  
        <p><em>Example 2.</em> Require key <c>myvar</c> with subkeys
          <c>sub1</c> and <c>sub2</c>:</p>

        <pre>
 ok = ct:require({myvar,[sub1,sub2]}).</pre>

        <p>In this case the configuration file must at least contain:</p>

        <pre>
 {myvar,[{sub1,Value},{sub2,Value}]}.</pre>

        <p><em>Example 3.</em> Require key <c>myvar</c> with subkey
          <c>sub1</c> with <c>subsub1</c>:</p>

        <pre>
 ok = ct:require({myvar,sub1,sub2}).</pre>

        <p>In this case the configuration file must at least contain:</p>

        <pre>
 {myvar,[{sub1,[{sub2,Value}]}]}.</pre>

        <p>See also
          <seemfa marker="#get_config/1"><c>ct:get_config/1</c></seemfa>,
          <seemfa marker="#get_config/2"><c>ct:get_config/2</c></seemfa>,
          <seemfa marker="#get_config/3"><c>ct:get_config/3</c></seemfa>,
          <seemfa marker="#require/2"><c>ct:require/2</c></seemfa>.</p>
        </desc>
    </func>

    <func>
      <name since="" name="require" arity="2" />
      <fsummary>Checks if the required configuration is available and gives
        it a name.</fsummary>
      <desc><marker id="require-2"/>
        <p>Checks if the required configuration is available and gives it a
          name. The semantics for <c>Required</c> is the same as in
          <seemfa marker="#require/1"><c>ct:require/1</c></seemfa> except
          that a list of <c>SubKey</c>s cannot be specified.</p>

       <p>If the requested data is available, the subentry is associated
         with <c>Name</c> so that the value of the element can be read with
         <seemfa marker="#get_config/1"><c>ct:get_config/1,2</c></seemfa>
         provided <c>Name</c> is used instead of the whole <c>Required</c>
         term.</p>

       <p><em>Example:</em></p>

       <p>Require one node with a Telnet connection and an FTP connection.
         Name the node <c>a</c>:</p>

       <pre>
 ok = ct:require(a,{machine,node}).</pre>

        <p>All references to this node can then use the node name. For
          example, a file over FTP is fetched like follows:</p>

        <pre>
 ok = ct:ftp_get(a,RemoteFile,LocalFile).</pre>

        <p>For this to work, the configuration file must at least contain:</p>

        <pre>
 {machine,[{node,[{telnet,IpAddr},{ftp,IpAddr}]}]}.</pre>

        <note><p>The behavior of this function changed radically in
          <c>Common Test</c> 1.6.2. To keep some backwards compatibility,
          it is still possible to do:<br/>
          <c>ct:require(a,{node,[telnet,ftp]}).</c><br/>
          This associates the name <c>a</c> with the top-level <c>node</c>
          entry. For this to work, the configuration file must at least
          contain:<br/>
          <c>{node,[{telnet,IpAddr},{ftp,IpAddr}]}.</c></p>
        </note>

        <p>See also
          <seemfa marker="#get_config/1"><c>ct:get_config/1</c></seemfa>,
          <seemfa marker="#get_config/2"><c>ct:get_config/2</c></seemfa>,
          <seemfa marker="#get_config/3"><c>ct:get_config/3</c></seemfa>,
          <seemfa marker="#require/1"><c>ct:require/1</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="run" arity="1" />
      <fsummary>Runs all test cases in all suites in the specified
        directories.</fsummary>
      <desc><marker id="run-1"/>
        <p>Runs all test cases in all suites in the specified directories.</p>

        <p>See also <seemfa marker="#run/3"><c>ct:run/3</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="run" arity="2" />
      <fsummary>Runs all test cases in the specified suite.</fsummary>
      <desc><marker id="run-2"/>
        <p>Runs all test cases in the specified suite.</p>

        <p>See also <seemfa marker="#run/3"><c>ct:run/3</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="run" arity="3" />
      <fsummary>Runs the specified test cases.</fsummary>
      <desc><marker id="run-3"/>
        <p>Runs the specified test cases.</p>

        <p>Requires that
          <seemfa marker="#install/1"><c>ct:install/1</c></seemfa> has been
            run first.</p>

        <p>Suites (<c>*_SUITE.erl</c>) files must be stored in <c>TestDir</c>
          or <c>TestDir/test</c>. All suites are compiled when the test is
          run.</p>
      </desc>
    </func>

    <func>
      <name since="" name="run_test" arity="1" />
      <fsummary>Runs tests as specified by the combination of options in
        Opts.</fsummary>
      <desc><marker id="run_test-1"/>
        <p>Runs tests as specified by the combination of options in
          <c>Opts</c>. The options are the same as those used with program
          <c>ct_run</c>, see <seecom marker="ct_run#ct_run">Run Tests from
          Command Line</seecom> in the <c>ct_run</c> manual page.</p>
        <p>Here a <c>TestDir</c> can be used to point out the path to a
          <c>Suite</c>. Option <c>testcase</c> corresponds to option
          <c>-case</c> in program <c>ct_run</c>. Configuration files
          specified in <c>Opts</c> are installed automatically at startup.</p>

        <p><c>TestRunnerPid</c> is returned if <c>release_shell == true</c>.
          For details, see
          <seemfa marker="#break/1"><c>ct:break/1</c></seemfa>.</p>

        <p><c>Reason</c> indicates the type of error encountered.</p>
      </desc>
    </func>

    <func>
      <name since="" name="run_testspec" arity="1" />
      <fsummary>Runs a test specified by TestSpec.</fsummary>
      <desc><marker id="run_testspec-1"/>
        <p>Runs a test specified by <c>TestSpec</c>. The same terms are used
          as in test specification files.</p>

        <p><c>Reason</c> indicates the type of error encountered.</p>
      </desc>
    </func>

    <func>
      <name since="OTP 19.1" name="set_verbosity" arity="2" />
      <fsummary>Set the verbosity level for a logging category.</fsummary>
      <desc><marker id="set_verbosity-2"/>
        <p>Use this function to set, or modify, the verbosity level for a logging
	category. See the <seeguide marker="write_test_chapter#logging">
	User's Guide</seeguide> for details. Use the value <c>default</c> to set the
	general verbosity level.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B" name="sleep" arity="1" />
      <fsummary>This function, similar to timer:sleep/1, suspends the
        test case for a specified time.</fsummary>
      <desc><marker id="sleep-1"/>
        <p>This function, similar to <c>timer:sleep/1</c> in STDLIB,
          suspends the test case for a specified time.
          However, this function also multiplies <c>Time</c> with the
          <c>multiply_timetraps</c> value (if set) and under certain
          circumstances also scales up the time automatically if
          <c>scale_timetraps</c> is set to <c>true</c> (default is
          <c>false</c>).</p>
      </desc>
    </func>

    <func>
      <name since="" name="start_interactive" arity="0" />
      <fsummary>Starts <c>Common Test</c> in interactive mode.</fsummary>
      <desc><marker id="start_interactive-0"/>
        <p>Starts <c>Common Test</c> in interactive mode.</p>

        <p>From this mode, all test case support functions can be executed
          directly from the Erlang shell. The interactive mode can also be
          started from the OS command line with <c>ct_run -shell
          [-config File...]</c>.</p>

        <p>If any functions (for example, Telnet or FTP) using
          "required configuration data" are to be called from the Erlang shell,
          configuration data must first be required with
          <seemfa marker="#require/2"><c>ct:require/2</c></seemfa>.</p>

        <p><em>Example:</em></p>

        <pre>
 &gt; ct:require(unix_telnet, unix).
 ok
 &gt; ct_telnet:open(unix_telnet).
 {ok,&lt;0.105.0&gt;}
 &gt; ct_telnet:cmd(unix_telnet, "ls .").
 {ok,["ls","file1  ...",...]}</pre>
      </desc>
    </func>

    <func>
      <name since="" name="step" arity="3" />
      <fsummary>Steps through a test case with the debugger.</fsummary>
      <desc><marker id="step-3"/>
        <p>Steps through a test case with the debugger.</p>

        <p>See also <seemfa marker="#run/3"><c>ct:run/3</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="step" arity="4" />
      <fsummary>Steps through a test case with the debugger.</fsummary>
      <desc><marker id="step-4"/>
        <p>Steps through a test case with the debugger. If option
          <c>config</c> has been specified, breakpoints are also set on
          the configuration functions in <c>Suite</c>.</p>

        <p>See also <seemfa marker="#run/3"><c>ct:run/3</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="stop_interactive" arity="0" />
      <fsummary>Exits the interactive mode.</fsummary>
      <desc><marker id="stop_interactive-0"/>
        <p>Exits the interactive mode.</p>

        <p>See also
          <seemfa marker="#start_interactive/0"><c>ct:start_interactive/0</c></seemfa>.
        </p>
      </desc>
    </func>

    <func>
      <name since="OTP R15B02" name="sync_notify" arity="2" />
      <fsummary>Sends a synchronous notification of type Name with Data to
        the <c>Common Test</c> event manager.</fsummary>
      <desc><marker id="sync_notify-2"/>
        <p>Sends a synchronous notification of type <c>Name</c> with
          <c>Data</c> to the <c>Common Test</c> event manager. This can later be
          caught by any installed event manager.</p>

        <p>See also
          <seeerl marker="stdlib:gen_event"><c>gen_event(3)</c></seeerl>.
        </p>
      </desc>
    </func>

    <func>
      <name since="" name="testcases" arity="2" />
      <fsummary>Returns all test cases in the specified suite.</fsummary>
      <desc><marker id="testcases-2"/>
        <p>Returns all test cases in the specified suite.</p>
      </desc>
    </func>

    <func>
      <name since="OTP R14B" name="timetrap" arity="1" />
      <fsummary>Sets a new timetrap for the running test case.</fsummary>
      <desc><marker id="timetrap-1"/>
        <p>Sets a new timetrap for the running test case.</p>

        <p>If the argument is <c>Func</c>, the timetrap is triggered when
          this function returns. <c>Func</c> can also return a new
          <c>Time</c> value, which in that case is the value for the new
          timetrap.</p>
      </desc>
    </func>

    <func>
      <name since="" name="userdata" arity="2" />
      <fsummary>Returns any data specified with tag userdata in the list of
        tuples returned from Suite:suite/0.</fsummary>
      <desc><marker id="userdata-2"/>
        <p>Returns any data specified with tag <c>userdata</c> in the list
          of tuples returned from
          <seemfa marker="ct_suite#Module:suite/0"><c>suite/0</c></seemfa>.</p>
      </desc>
    </func>

    <func>
      <name since="" name="userdata" arity="3" />
      <fsummary>Returns any data specified with tag userdata in the list of
        tuples returned from Suite:group(GroupName) or Suite:Case().</fsummary>
      <desc><marker id="userdata-3"/>
        <p>Returns any data specified with tag <c>userdata</c> in the list
          of tuples returned from <c>Suite:group(GroupName)</c> or
          <c>Suite:Case()</c>.</p>
      </desc>
    </func>
  </funcs>

</erlref>


