exercises2

advertisement
Test AveCalc with Fitnesse
Alessandro Marchetto
AveCalc
(1) Read this exercise specification
http://selab.fbk.eu/swat/exercises/fitneese-2.ppt
(2) Download the application Eclipse project and import in your Eclipse
(a) http://selab.fbk.eu/swat/exercises/AveCalc.zip
(b) File  Import  Archieve File + Next  … select the zip and import it
(3) Run and Understand the AveCalc application
(4) Understand this AveCalc specification and exercise description
(5) Try to apply the black-box testing technique to identify test cases
(6) Implement such test cases in Fitnesse
(7) Run them
AveCalc description
• AveCalc is a “desktop application” that manages an electronic register
(record book) for master students.
• A student can add a new exam to the register, remove an existing exam
and remove all exams. An exam has a name, a CFU (a positive number
that represent the university credits) and a (optional) vote. An exam
without vote is an exam not taken. The vote must be included (or
equal) between 0 and 30. If the vote is >= 18 then the vote is positive,
otherwise it is negative. It is possible to save the register and load it
(all data or only positive exams).
• AveCalc computes some statistics: average of the exams passed, total
number of CFU, number of exams passed, (hypothetical) degree vote
and whether the student has passed a number of exams sufficient to
defend his/her thesis
AveCalc GUI
Populate the Database
1) Write a test case to populate the database
An exam is composed of a name, CFU (i.e., a number that
represent the university credit of the exam) and an optional
vote.
Add an Exam
2) Write a test case to add a new exam
A student can add a new exam to the register. An exam is
composed of a name, CFU (i.e., a number that represent
the university credit of the exam) and an optional vote. The
name is unique, CFU is a positive number (>=0) and the
vote, if inserted, is a number included between 0 and 30
(the vote can be also 0 or 30). A vote < 18 is negative (i.e.,
the exam is not passed) while >= 18 is positive (i.e., the
exam is passed). An exam can be inserted also without the
vote; it can be inserted later. 'Laude' can be added only
when the vote is 30
Remove an Exam
3) Write a test case to remove an existing exam
A student can remove an existing exam from the database
Compute the average
4) Write a test case to compute the average of the exam vote
The average is computed each time an exam is added to the
register. Precisely, the average is a Weighted arithmetic
mean (see http://en.wikipedia.org/wiki/Weighted_mean)
where the weights are the CFU. A negative vote is not
counted, that is, it is not considered in the calculation of
the average
Compute the number of Exams
5) Write a test case to compute the number of exams
The 'the total number of exams' is updated each time an exam
is added to the register. This value gives the sum of all the
exams that are in the register.
Download