Professional Documents
Culture Documents
An Automatic Tool For Generating Test Cases From The System's Requirements
An Automatic Tool For Generating Test Cases From The System's Requirements
An Automatic Tool For Generating Test Cases From The System's Requirements
Rosziati Ibrahima
Mohd Zainuri Saringat, Noraini Ibrahim and Noraida Ismailb
a
Research Management and Innovation Centre (RMIC),
b
Faculty of Information Technology and Multimedia,
Universiti Tun Hussein Onn Malaysia (UTHM)
rosziati@uthm.edu.my, zainuri@uthm.edu.my, noraini@uthm.edu.my, noraida@menersys.com
862
From the use case diagram, the flow of events can be events. Figure 2 shows the sequence diagram for use
constructed. For example, Table 1 shows the flows of case PurchaseDrink for a scenario when invalid coins
events for the basic flows, the alternative, as well as are input.
the preconditions and the postconditions of the use
case PurchaseDrink.
: Customer : VMCustomer : DrinkContainer : File
Panel
Preconditions: 2: checkAvailDrinks()
7: getPrice( )
Main Success Scenario: 8: getQuantity( )
863
the system should do. The tool is also able to generated; otherwise, an invalid error message will be
automatically generate the test cases of the system displayed indicating that the inconsistency exists
according to the use-case diagram that has been between the flow of events and the sequence diagrams.
formed previously. The test cases are generated automatically from the
tool as the output of the tool. The output is displayed
The tool is developed using object-oriented
on the screen as well as stored in a file with extension
approach with C++ programming language. The tool
.txt, namely output.txt. A user can open this output file
has 3 major components as shown in Figure 3.
by using a Notepad or Microsoft Word. The output can
be used as a checklist for a programmer to test the
system that he or she will develop according to the
provided test cases. These test cases can also be used
Workspac Î Engine Î Test to validate the results of the test cases so the
e requirements of the system are meet.
Cases Figure 4 shows the tool for generating the test cases.
A user who uses the tool can layout the use cases using
the Workspace. The Toolbox is used in order to ease
Figure 3: Components of GenTCase the drawing of the use-case diagram. The description
of each of the button in the Toolbox is explained in
Figure 5. User can also use the Workspace to layout
From Figure 3, the tool allows a user to layout the the flow of events and sequence diagrams. Then, the
use-case diagram of any system in the workspace button (as shown in number 11 for generator of test
provided. The workspace is used as a place for a user cases) is clicked to generate the test cases.
to provide the system’s requirements by means of a
use-case diagram, flow of events and sequence
diagrams. In the workspace, a Toolbox is used to
create, edit and display the use-case diagram, flow of
events and sequence diagrams. The Toolbox consists
of standard symbols and arrows for UML Specification
such as symbols for an actor and a use case, and
arrows for connecting an actor with use cases as well
as arrow for generalizations. In the Workspace, a user
can also type-in the text for each of the use cases used
in the Text Box provided by the tool. The Workspace
will allow a user of the tool to layout the use-case
diagram, flow of events and sequence diagrams
according to any system.
Once the use-case diagram has been finalized, the
user can layout the flow of events and sequence
diagrams using the workspace provided. Then the user Figure 4: Interface of GenTCase for Test Cases
can generate the test cases by using the generator of
the tool. The Engine will take all the use cases, check For this particular example of an application for a
the consistency of the flow of events with sequence simple drink vending machine system, the use-case
diagrams and search the keywords used in the provided diagram from Figure 1 is used in the Workspace
database. The database consists of most standard together with added information from Table 1 (flow of
keywords of a use case. Once the use case used events) and Figure 2 (sequence diagram). Then, the
matches the keyword inside the database, the engine generator is used to generate the test cases of the drink
will generate its respective test cases according to its vending machine system.
use case.
The tool will produce the test cases based on the
use-case diagram provided in the workspace. The
validity of test cases is checked using the flow of
events and sequence diagrams. If the flow of events
and sequence diagrams are consistent, the test cases are
864
No. Item to the customer’s request, and the drink is not served at
1 Selection Tools all.
2 Text Box
3 Use Case
4 Actor
5 Note
6 Anchor Note
7 Package
8 Undirectional association
9 Dependency or instantiates
10 Generalizations
11 Generator for the Test Cases
Figure 8: Test Cases of Use Case GetBalance
Figure 5: Descriptions of Buttons in Tool Box
From Figure 8, for use case GetBalance, the test
Once the button of the “Generator for the Test cases consist of whether the correct balance of coins is
Cases” is clicked, the consistency of flow of events returned or incorrect balance of coins is returned, and
and sequence diagrams is checked in order to generate no balance returned.
the valid test cases accordingly. For example, Figures
6, 7 and 8 show the generated test cases according to
5. Conclusion and Future Work
use cases PurchaseDrink, GetDrink and GetBalance,
respectively.
GenTCase is a tool that is able to generate the test
cases automatically according to the system’s
requirements. The system’s requirements are
transformed into use case diagram, flow of events and
sequence diagrams. The flow of events and sequence
diagrams are used as added information for
consistency and validity of the generated test cases.
The test cases can be used as a checklist for a
programmer to validate that the system meets its
requirements. The purpose of GenTCase is to reduce
the cost of testing the system as well as save the time
Figure 6: Test Cases of Use Case PurchaseDrink of producing the test cases manually.
GenTCase has its limitations where the use cases
From Figure 6, for use case PurchaseDrink, the test used are only for functional requirements of a system.
cases consist of whether the coins that input by the The tool is unable to capture the non-functional
customer are enough or not enough for the drink requirements of a system. Therefore, the non-
purchased, and no coins are input. functional requirements need to be captured and tested
outside of the tool. For future work, we intend to
extend the capabilities of the tool such as incorporating
activity diagrams to allow more efficient test cases
being generated.
6. Acknowledgements
This research is under UTHM Fundamental
Research Grant Vot 0233.
865
Approach, IEEE Transactions on Software
[2] Gutierez J., Escalona M.J. and Torres M.M. An Engineeering, Vol 32, No. 3, 2006, pp. 140-155.
Approach to Generate Test Cases from Use Cases,
Proceedings of the 6th International Conference on Web [6] Rational. Mastering Requirements Management with
Engineering, 2006, pp. 113-114. Use Cases, Rational Software, IBM, 2003.
[3] Heumann J. Generating Test Cases from Use Cases, [7] Sommerville I. Software Engineering Eight Edition,
Rational Software, IBM, 2001. Addison Wesley, 2007.
[4] Hui L. and Hee B.K.T. Automated Verification and Test [8] Wee K.L., Siau C.K. and Yi S. Automated Generation
Case Generation for Input Validation, Proceedings of of Test Programs from Closed Specifications of Classes
the 2006 International Workshop on Automation on and Test Cases, Proceedings of the 26th International
Software Test (AST’06) 2006, pp. 29-35. Conference on Software Engineering (ICSE’04), 2004,
pp. 52-57.
[5] Nebut C, Fleurey F, Traon Y.L. and Jezequel J.M.
Automatic Test Generation: A Use Case Driven
866