~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/common_test/doc/src/write_test_chapter.xml

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<chapter>
5
5
  <header>
6
6
    <copyright>
7
 
      <year>2003</year><year>2009</year>
 
7
      <year>2003</year><year>2011</year>
8
8
      <holder>Ericsson AB. All Rights Reserved.</holder>
9
9
    </copyright>
10
10
    <legalnotice>
13
13
      compliance with the License. You should have received a copy of the
14
14
      Erlang Public License along with this software. If not, it can be
15
15
      retrieved online at http://www.erlang.org/.
16
 
    
 
16
 
17
17
      Software distributed under the License is distributed on an "AS IS"
18
18
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19
19
      the License for the specific language governing rights and limitations
20
20
      under the License.
21
 
    
 
21
 
22
22
    </legalnotice>
23
23
 
24
24
    <title>Writing Test Suites</title>
115
115
    </p>
116
116
  </section>
117
117
 
 
118
  <marker id="per_testcase"/>
118
119
  <section>
119
120
    <title>Init and end per test case</title>
120
121
 
157
158
      <c>{skipped,Reason}</c> (where Reason is a user specific term).
158
159
    </p>
159
160
 
 
161
    <p>The <c>end_per_testcase/2</c> function is called even after a
 
162
      test case terminates due to a call to <c>ct:abort_current_testcase/1</c>,
 
163
      or after a timetrap timeout. However, <c>end_per_testcase</c>
 
164
      will then execute on a different process than the test case
 
165
      function, and in this situation, <c>end_per_testcase</c> will
 
166
      not be able to change the reason for test case termination by
 
167
      returning <c>{fail,Reason}</c>, nor will it be able to save data with
 
168
      <c>{save_config,Data}</c>.</p>
 
169
 
160
170
    <p>If <c>init_per_testcase</c> crashes, the test case itself is skipped 
161
171
    automatically (so called <em>auto skipped</em>). If <c>init_per_testcase</c>
162
172
    returns a <c>skip</c> tuple, also then will the test case be skipped (so
682
692
      <c>end_per_suite</c> execute, like test cases, on dedicated Erlang
683
693
      processes.
684
694
    </p>
 
695
  </section>
685
696
 
 
697
  <section>
 
698
    <title>Timetrap timeouts</title>
 
699
    <marker id="timetraps"></marker>
686
700
    <p>The default time limit for a test case is 30 minutes, unless a
687
 
      <c>timetrap</c> is specified either by the test case info function
688
 
      or the <c>suite/0</c> function.
689
 
    </p>
690
 
 
 
701
      <c>timetrap</c> is specified either by the suite info function
 
702
      or a test case info function. The timetrap timeout value defined
 
703
      in <c>suite/0</c> is the value that will be used for each test case
 
704
      in the suite (as well as for the configuration functions
 
705
      <c>init_per_suite/1</c> and <c>end_per_suite</c>). A timetrap timeout
 
706
      value set with the test case info function will override the value set
 
707
      by <c>suite/0</c>, but only for that particular test case.</p>
 
708
    <p>It is also possible to set/reset a timetrap during test case (or
 
709
      configuration function) execution. This is done by calling
 
710
      <c>ct:timetrap/1</c>. This function will cancel the current timetrap
 
711
      and start a new one.</p>
 
712
    <p>Timetrap values can be extended with a multiplier value specified at
 
713
      startup with the <c>multiply_timetraps</c> option. It is also possible
 
714
      to let Test Server decide to scale up timetrap timeout values
 
715
      automatically, e.g. if tools such as cover or trace are running during
 
716
      the test. This feature is disabled by default and can be enabled with
 
717
      the <c>scale_timetraps</c> start option.</p>
 
718
    <p>If a test case needs to suspend itself for a time that also gets
 
719
      multipled by <c>multiply_timetraps</c>, and possibly scaled up if
 
720
      <c>scale_timetraps</c> is enabled, the function <c>ct:sleep/1</c>
 
721
      may be called.</p>
691
722
  </section>
692
723
 
693
724
  <section>