Author:halw

Date:2009-02-10T21:36:52.000000Z


git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@183 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
halw
2009-02-10 21:36:52 +00:00
parent ae47537446
commit f1466a46a7
2 changed files with 20 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
==A system to test==
For developing our manual test, let's use a simple system that contains a class modeling bank accounts. Here are two classes that will make up our system. The first, <code>APPLICATION</code> will be the root class of our system. It looks like this:
For developing our manual test, let's use a simple system that contains a class modeling bank accounts. Here are two classes that will make up our system. The first, <code>APPLICATION</code> will be the root class of our system. <code>APPLICATION</code> really only serves to declare an attribute of type <code>BANK_ACCOUNT</code>, which is the class we will write a test against. <code>APPLICATION</code> looks like this:
<code>
class
@@ -23,8 +23,6 @@ feature {NONE} -- Initialization
make
-- Run application.
do
create my_account
my_account.deposit (200)
end
my_account: BANK_ACCOUNT
@@ -46,12 +44,15 @@ inherit
feature
default_create
do
balance := 300
balance := 0
end
balance: INTEGER
deposit (an_amount: INTEGER)
-- Deposit `an_amount'.
require
amount_large_enough: an_amount > 0
do
ensure
balance_increased: balance > old balance
@@ -59,6 +60,10 @@ feature
end
withdraw (an_amount: INTEGER)
-- Withdraw `an_amount'.
require
amount_large_enough: an_amount > 0
amount_valid: balance >= an_amount
do
balance := balance - an_amount
ensure
@@ -71,7 +76,7 @@ invariant
end
</code>
You shouldn't worry if you've noticed that the class <code>BANK_ACCOUNT</code> has some pretty obvious flaws. We'll deal with those later.
You shouldn't let it worry you if you've noticed that the class <code>BANK_ACCOUNT</code> contains some flaws. We'll deal with these later.
If you want to work along with this tutorial, you should be able to copy the text of each these classes from this page and paste it into the EiffelStudio editor pane. Build a system using these two classes.

View File

@@ -0,0 +1,10 @@
[[Property:title|Execute tests]]
[[Property:weight|3]]
[[Property:uuid|d0515cb1-0792-3028-2a24-a71b56506959]]
The Eiffel Testing Framework allows you to execute a set of tests.
==About Test Results==