• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Test driven development with Boost.Test</title>
5<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Boost.Test">
8<link rel="up" href="../tutorials.html" title="Tutorials">
9<link rel="prev" href="../tutorials.html" title="Tutorials">
10<link rel="next" href="hello.html" title="A testing framework, what for?">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="../tutorials.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="hello.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="boost_test.practical_usage_recommendations.tutorials.bt_and_tdd"></a><a class="link" href="bt_and_tdd.html" title="Test driven development with Boost.Test">Test
28        driven development with Boost.Test</a>
29</h4></div></div></div>
30<p>
31          Today is a momentous day - first day of new year. Today I am going to start
32          a new life. I am going to stop eating a greasy food, start attending a
33          fitness club and ... today I am going to test programs I am writing. I
34          can start right after the last line of a program is completed or, even
35          better, I can write tests while I am coding. And maybe next time I will
36          write tests before the coding, during the design stage. I have read a lot
37          of literature on how to write the tests, I have the unit test framework
38          in hand and an idea of new class. So let's get started.
39        </p>
40<p>
41          Let say I want to encapsulate an unchangeable C character buffer with a
42          length into the simple class <code class="computeroutput"><span class="identifier">const_string</span></code>.
43          Rationale: a string class that does not allocate a memory and provide a
44          convenient read-only access to the pre-allocated character buffer. I will
45          probably want <code class="computeroutput"><span class="identifier">const_string</span></code>
46          to have an interface similar to the class std::string. What will I do first?
47          In my new life I will start with writing a test module for future class
48          <code class="computeroutput"><span class="identifier">const_string</span></code>. It will look
49          like this:
50        </p>
51<pre class="programlisting"><span class="preprocessor">#define</span> <a class="link" href="../../utf_reference/link_references/link_boost_test_module_macro.html" title="BOOST_TEST_MODULE"><code class="computeroutput"><span class="identifier">BOOST_TEST_MODULE</span></code></a> <span class="identifier">const_string</span> <span class="identifier">test</span>
52<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
53</pre>
54<p>
55          Now I can compile it and link with the unit test framework. Done! I have
56          a working test program. It is empty, so when I run the program it produces
57          following output:
58        </p>
59<pre class="programlisting"><span class="special">***</span> <span class="identifier">No</span> <span class="identifier">errors</span> <span class="identifier">detected</span></pre>
60<p>
61          Well, now it could be a good time to start a work on <code class="computeroutput"><span class="identifier">const_string</span></code>.
62          First thing I imagine would be good to have is a constructors and trivial
63          access methods. So my class initial version looks like this:
64        </p>
65<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">const_string</span> <span class="special">{</span>
66<span class="keyword">public</span><span class="special">:</span>
67  <span class="comment">// Constructors</span>
68  <span class="identifier">const_string</span><span class="special">();</span>
69  <span class="identifier">const_string</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">s</span> <span class="special">)</span>
70  <span class="identifier">const_string</span><span class="special">(</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">s</span> <span class="special">);</span>
71  <span class="identifier">const_string</span><span class="special">(</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">length</span> <span class="special">);</span>
72  <span class="identifier">const_string</span><span class="special">(</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">begin</span><span class="special">,</span> <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">end</span> <span class="special">);</span>
73
74  <span class="comment">// Access methods</span>
75  <span class="keyword">char</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">data</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
76  <span class="identifier">size_t</span>      <span class="identifier">length</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
77  <span class="keyword">bool</span>        <span class="identifier">is_empty</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
78
79  <span class="comment">// ...</span>
80<span class="special">};</span>
81</pre>
82<p>
83          Now I am able to write a first test case - constructors testing - and add
84          it to a test suite. My test program became to look like this:
85        </p>
86<pre class="programlisting"><span class="preprocessor">#define</span> <a class="link" href="../../utf_reference/link_references/link_boost_test_module_macro.html" title="BOOST_TEST_MODULE"><code class="computeroutput"><span class="identifier">BOOST_TEST_MODULE</span></code></a> <span class="identifier">const_string</span> <span class="identifier">test</span>
87<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
88
89<a class="link" href="../../utf_reference/test_org_reference/test_org_boost_auto_test_case.html" title="BOOST_AUTO_TEST_CASE"><code class="computeroutput"><span class="identifier">BOOST_AUTO_TEST_CASE</span></code></a><span class="special">(</span> <span class="identifier">constructors_test</span> <span class="special">)</span>
90<span class="special">{</span>
91  <span class="identifier">const_string</span> <span class="identifier">cs0</span><span class="special">(</span> <span class="string">""</span> <span class="special">);</span>                                                 <span class="comment">// 1 //</span>
92  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs0</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size_t</span><span class="special">)</span><span class="number">0</span> <span class="special">);</span>
93  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs0</span><span class="special">.</span><span class="identifier">is_empty</span><span class="special">()</span> <span class="special">);</span>
94
95  <span class="identifier">const_string</span> <span class="identifier">cs01</span><span class="special">(</span> <span class="identifier">NULL</span> <span class="special">);</span>                                              <span class="comment">// 2 //</span>
96  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs01</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">==</span> <span class="special">(</span><span class="identifier">size_t</span><span class="special">)</span><span class="number">0</span> <span class="special">);</span>
97  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs01</span><span class="special">.</span><span class="identifier">is_empty</span><span class="special">()</span> <span class="special">);</span>
98
99  <span class="identifier">const_string</span> <span class="identifier">cs1</span><span class="special">(</span> <span class="string">"test_string"</span> <span class="special">);</span>                                      <span class="comment">// 3 //</span>
100  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">strcmp</span><span class="special">(</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="string">"test_string"</span> <span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
101  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">==</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">strlen</span><span class="special">(</span><span class="string">"test_string"</span><span class="special">)</span> <span class="special">);</span>
102
103  <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">s</span><span class="special">(</span> <span class="string">"test_string"</span> <span class="special">);</span>                                         <span class="comment">// 4 //</span>
104  <span class="identifier">const_string</span> <span class="identifier">cs2</span><span class="special">(</span> <span class="identifier">s</span> <span class="special">);</span>
105  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">strcmp</span><span class="special">(</span> <span class="identifier">cs2</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="string">"test_string"</span> <span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
106
107  <span class="identifier">const_string</span> <span class="identifier">cs3</span><span class="special">(</span> <span class="identifier">cs1</span> <span class="special">);</span>                                                <span class="comment">// 5 //</span>
108  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">strcmp</span><span class="special">(</span> <span class="identifier">cs3</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="string">"test_string"</span> <span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
109
110  <span class="identifier">const_string</span> <span class="identifier">cs4</span><span class="special">(</span> <span class="string">"test_string"</span><span class="special">,</span> <span class="number">4</span> <span class="special">);</span>                                   <span class="comment">// 6 //</span>
111  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">strncmp</span><span class="special">(</span> <span class="identifier">cs4</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="string">"test"</span><span class="special">,</span> <span class="identifier">cs4</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
112
113  <span class="identifier">const_string</span> <span class="identifier">cs5</span><span class="special">(</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">data</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">);</span>                    <span class="comment">// 7 //</span>
114  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">strncmp</span><span class="special">(</span> <span class="identifier">cs5</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="string">"test_string"</span><span class="special">,</span> <span class="identifier">cs5</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">)</span> <span class="special">==</span> <span class="number">0</span> <span class="special">);</span>
115
116  <span class="identifier">const_string</span> <span class="identifier">cs_array</span><span class="special">[]</span> <span class="special">=</span> <span class="special">{</span> <span class="string">"str1"</span><span class="special">,</span> <span class="string">"str2"</span> <span class="special">};</span>                           <span class="comment">// 8 //</span>
117  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs_array</span><span class="special">[</span><span class="number">0</span><span class="special">]</span> <span class="special">==</span> <span class="string">"str1"</span> <span class="special">);</span>
118  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs_array</span><span class="special">[</span><span class="number">1</span><span class="special">]</span> <span class="special">==</span> <span class="string">"str2"</span> <span class="special">);</span>
119<span class="special">}</span>
120</pre>
121<p>
122          The constructors_test test case is intended to check a simple feature of
123          the class <code class="computeroutput"><span class="identifier">const_string</span></code>:
124          an ability to construct itself properly based on different arguments. To
125          test this feature I am using such characteristics of constructed object
126          as a data it contains and a length. The specification of the class <code class="computeroutput"><span class="identifier">const_string</span></code> does not contain any expected
127          failures, so, though the constructor can fail if I would pass a pointer
128          to an invalid memory, error check control is not performed (can't require
129          what was not promised :-)). But for any valid input it should work. So
130          I am trying to check a construction for an empty string (1), a NULL string
131          (2) a regular C string(3), an STL string(4), a copy construction(5) and
132          so on. Well, after fixing all the errors in the implementation (do you
133          write programs without errors from scratch?) I am able to pass this test
134          case and the unit test framework gives me the following report:
135        </p>
136<pre class="programlisting"><span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span>
137
138<span class="special">***</span> <span class="identifier">No</span> <span class="identifier">errors</span> <span class="identifier">detected</span>
139</pre>
140<p>
141          Encouraged I am moving on and adding more access methods:
142        </p>
143<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">const_string</span> <span class="special">{</span>
144<span class="keyword">public</span><span class="special">:</span>
145  <span class="comment">//...</span>
146  <span class="keyword">char</span> <span class="keyword">operator</span><span class="special">[](</span> <span class="identifier">size_t</span> <span class="identifier">index</span> <span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
147  <span class="keyword">char</span> <span class="identifier">at</span><span class="special">(</span> <span class="identifier">size_t</span> <span class="identifier">index</span> <span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
148  <span class="comment">//...</span>
149<span class="special">};</span>
150</pre>
151<p>
152          I added the new feature - I need a new test case to check it. As a result
153          my test suite became to look like this:
154        </p>
155<pre class="programlisting"><span class="preprocessor">#define</span> <a class="link" href="../../utf_reference/link_references/link_boost_test_module_macro.html" title="BOOST_TEST_MODULE"><code class="computeroutput"><span class="identifier">BOOST_TEST_MODULE</span></code></a> <span class="identifier">const_string</span> <span class="identifier">test</span>
156<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
157
158<a class="link" href="../../utf_reference/test_org_reference/test_org_boost_auto_test_case.html" title="BOOST_AUTO_TEST_CASE"><code class="computeroutput"><span class="identifier">BOOST_AUTO_TEST_CASE</span></code></a><span class="special">(</span> <span class="identifier">constructors_test</span> <span class="special">)</span>
159<span class="special">{</span>
160  <span class="comment">//...</span>
161<span class="special">}</span>
162
163<a class="link" href="../../utf_reference/test_org_reference/test_org_boost_auto_test_case.html" title="BOOST_AUTO_TEST_CASE"><code class="computeroutput"><span class="identifier">BOOST_AUTO_TEST_CASE</span></code></a><span class="special">(</span> <span class="identifier">data_access_test</span> <span class="special">)</span>
164<span class="special">{</span>
165  <span class="identifier">const_string</span> <span class="identifier">cs1</span><span class="special">(</span> <span class="string">"test_string"</span> <span class="special">);</span>                                <span class="comment">// 1 //</span>
166  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs1</span><span class="special">[(</span><span class="identifier">size_t</span><span class="special">)</span><span class="number">0</span><span class="special">]</span> <span class="special">==</span> <span class="char">'t'</span> <span class="special">);</span>
167  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs1</span><span class="special">[(</span><span class="identifier">size_t</span><span class="special">)</span><span class="number">4</span><span class="special">]</span> <span class="special">==</span> <span class="char">'_'</span> <span class="special">);</span>
168  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs1</span><span class="special">[</span><span class="identifier">cs1</span><span class="special">.</span><span class="identifier">length</span><span class="special">()-</span><span class="number">1</span><span class="special">]</span> <span class="special">==</span> <span class="char">'g'</span> <span class="special">);</span>
169
170  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs1</span><span class="special">[(</span><span class="identifier">size_t</span><span class="special">)</span><span class="number">0</span><span class="special">]</span> <span class="special">==</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span> <span class="number">0</span> <span class="special">)</span> <span class="special">);</span>                      <span class="comment">// 2 //</span>
171  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs1</span><span class="special">[(</span><span class="identifier">size_t</span><span class="special">)</span><span class="number">2</span><span class="special">]</span> <span class="special">==</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span> <span class="number">5</span> <span class="special">)</span> <span class="special">);</span>
172  <a class="link" href="../../utf_reference/testing_tool_ref/assertion_boost_test_universal_macro.html" title="BOOST_TEST"><code class="computeroutput"><span class="identifier">BOOST_TEST</span></code></a><span class="special">(</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">-</span> <span class="number">1</span> <span class="special">)</span> <span class="special">==</span> <span class="char">'g'</span> <span class="special">);</span>
173
174  <span class="identifier">BOOST_CHECK_THROW</span><span class="special">(</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">at</span><span class="special">(</span> <span class="identifier">cs1</span><span class="special">.</span><span class="identifier">length</span><span class="special">()</span> <span class="special">),</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">out_of_range</span> <span class="special">);</span>   <span class="comment">// 3 //</span>
175<span class="special">}</span>
176</pre>
177<p>
178          In the data_access_test test case I am trying to check the class <code class="computeroutput"><span class="identifier">const_string</span></code> character access correctness.
179          While tests (1) checks valid access using <code class="computeroutput"><span class="identifier">const_string</span><span class="special">::</span><span class="keyword">operator</span><span class="special">[]</span></code> and test (2) checks valid access using
180          method <code class="computeroutput"><span class="identifier">const_string</span><span class="special">::</span><span class="identifier">at</span><span class="special">()</span></code>,
181          there is one more thing to test. The specification of the method <code class="computeroutput"><span class="identifier">const_string</span><span class="special">::</span><span class="identifier">at</span><span class="special">()</span></code>
182          contains validation for the out of bound access. That was test (3) is intended
183          to do: check that the validation is working. A testing of a validation
184          and error handling code is an important part of a unit testing and should
185          not be left for a production stage. The data_access_test test case passed
186          and I am ready for the next step.
187        </p>
188<p>
189          Continuing my effort I am able to complete class <code class="computeroutput"><span class="identifier">const_string</span></code>
190          (see <a href="../../../../snippet/const_string.hpp" target="_top">Listing 1 <code class="literal">const_string.hpp</code></a>)
191          and testing module for it (see <a href="../../../../snippet/const_string_test.cpp" target="_top">Listing
192          2 <code class="literal">const_string_test.cpp</code></a>) that is checking all
193          features that are presented in the class <code class="computeroutput"><span class="identifier">const_string</span></code>
194          specification.
195        </p>
196<p>
197          Well, I am step closer to fulfilling my new year resolution (we should
198          see about this fitness club sometime next ...). What about you? Your testing
199          habits could be a little different. You could start with a class/library
200          development and then at some point start writing test cases on feature
201          basis. Or you can, given a detailed specification for the future product,
202          including expected interfaces, immediately start with writing all test
203          cases (or it could be a different person, while you working on implementation
204          at the same time). In any case you should not have any problems to use
205          facilities provided by the Boost.Test unit test framework and, let me hope,
206          be able to write a stable, bulletproof code. And what is even more important
207          is your confidence in an ability to make changes of any complexity without
208          involving a lengthy regression testing of your whole product. Your test
209          module and the unit test framework will stay behind your back to help you
210          with any occasional errors.
211        </p>
212</div>
213<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
214<td align="left"></td>
215<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
216        Distributed under the Boost Software License, Version 1.0. (See accompanying
217        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
218      </p>
219</div></td>
220</tr></table>
221<hr>
222<div class="spirit-nav">
223<a accesskey="p" href="../tutorials.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorials.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="hello.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
224</div>
225</body>
226</html>
227