2362 |
|
|
2363 |
</chapter> |
</chapter> |
2364 |
|
|
2365 |
|
<chapter id=unit xreflabel="Unit Testing"> |
2366 |
|
<title>Unit Testing</title> |
2367 |
|
|
2368 |
|
<sect1 id=unittest xreflabel="What Is Unit Testing ?"> |
2369 |
|
<title>What Is Unit Testing ?</title> |
2370 |
|
|
2371 |
|
<para>Most regression testing as done by DejaGnu is system |
2372 |
|
testing. This is the complete application is tested all at |
2373 |
|
once. Unit testing is for testing single files, or small |
2374 |
|
libraries. In this case, each file is linked with a test case in |
2375 |
|
C or C++, and each function or class and method is tested in |
2376 |
|
series, with the test case having to check private data or |
2377 |
|
global variable to see if the function or method worked.</para> |
2378 |
|
|
2379 |
|
<para>This works particularly well for testing API and a level |
2380 |
|
where it is easier to debug them, than by need to trace through |
2381 |
|
the entire appication. Also if there is a specification for the |
2382 |
|
API to be tested, the testcase can also function as a compliance |
2383 |
|
test.</para> |
2384 |
|
|
2385 |
|
</sect1> |
2386 |
|
|
2387 |
|
<sect1 id=djh xreflabel="The dejagnu.h Header File"> |
2388 |
|
<title>The dejagnu.h Header File</title> |
2389 |
|
|
2390 |
|
<para>DejaGnu uses a single header file to assist in unit |
2391 |
|
testing. As this file also produces it's one test state output, |
2392 |
|
it can be run standalone, which is very useful for testing on |
2393 |
|
embedded systems. This header file has a C and C++ API for the |
2394 |
|
test states, with simple totals, and standardized |
2395 |
|
output. Because the output has been standardized, DejaGnu can be |
2396 |
|
made to work with this test case, without writing almost any |
2397 |
|
Tcl. The library module, dejagnu.exp, will look for the output |
2398 |
|
messages, and then merge them into DejaGnu's.</para> |
2399 |
|
|
2400 |
|
</sect1> |
2401 |
|
|
2402 |
|
</chapter> |
2403 |
|
|
2404 |
<!-- Keep this comment at the end of the file |
<!-- Keep this comment at the end of the file |
2405 |
Local variables: |
Local variables: |
2406 |
mode: sgml |
mode: sgml |