Difference between revisions of "Using CDD"

(How to add a manual test case)
(How to add a manual test case)
Line 15: Line 15:
 
To add a manual test case simply create a new class whose name contains the word ''''TEST'''', have it inherit from CDD_TEST_CASE and add one or several unit test routines. Make sure that all unit test routines start with ''''test_''''. Here is a simple example test class:
 
To add a manual test case simply create a new class whose name contains the word ''''TEST'''', have it inherit from CDD_TEST_CASE and add one or several unit test routines. Make sure that all unit test routines start with ''''test_''''. Here is a simple example test class:
  
<code>
+
<eiffel>
class FOO
+
class TEST_BANK_ACCOUNT
 +
inherit CDD_TEST_CASE
 +
feature
 +
  test_deposit
 +
    local
 +
      ba: BANK_ACCOUNT
 +
    do
 +
      create ba.make_with_balance (0)
 +
      ba.deposit (100)
 +
      check
 +
        money_depisited: ba.balance = 100
 +
      end
 +
    end
 
end
 
end
</code>
+
</eiffel>
  
 
= How to extract a test case =
 
= How to extract a test case =

Revision as of 05:47, 28 January 2008


Getting Started

  • First you need to make the two CDD tool windows 'Testing' and 'CDD Output' visible. Do that by going to the menu 'View -> Tools' and select 'Testing' and 'CDD Output':
Enable cdd.png
  • Now enable background execution and extraction of test cases. The first will cause the execution of your test cases after every compilation and the second will extract a new test case after every exception. To enable both make sure both of the toolbar buttons (marked in red) below are pressed.
Enable exec and extract.png

How to add a manual test case

To add a manual test case simply create a new class whose name contains the word 'TEST', have it inherit from CDD_TEST_CASE and add one or several unit test routines. Make sure that all unit test routines start with 'test_'. Here is a simple example test class:

class TEST_BANK_ACCOUNT
inherit CDD_TEST_CASE
feature
  test_deposit
    local
      ba: BANK_ACCOUNT
    do
      create ba.make_with_balance (0)
      ba.deposit (100)
      check
         money_depisited: ba.balance = 100
      end
    end
end

How to extract a test case

How to search for a test case

How to add a tag to a test case

How to restrict test case execution