generating test cases using uml communication diagram

24
1 Dr. D. P. Mohapatra Assistant Professor, C. S. E. Deptt. National Institute of Technology, Rourkela Generating test cases using UML Communication Diagram www.carrertime.in www.facebook.com/carrertime.in

Upload: praveen-penumathsa

Post on 18-Jul-2015

99 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Generating test cases using UML Communication Diagram

1

Dr. D. P. Mohapatra Assistant Professor, C. S. E. Deptt.

National Institute of Technology, Rourkela

Generating test cases using UML Communication Diagram

www.carrertime.inwww.facebook.com/carrertime.in

Page 2: Generating test cases using UML Communication Diagram

2

Outline of the Presentation

• Introduction

• Motivation

• Objectives

• Overall procedure

• Summary

Page 3: Generating test cases using UML Communication Diagram

3

Introduction

• In a typical software development project, more than 50% of the software development effort is being spent on testing.

• Quality of the end product and effective reuse of software depend to a large extent on testing.

• So, Developers spend considerable amount of time and effort to achieve thorough testing.

Page 4: Generating test cases using UML Communication Diagram

4

• Regardless of the test strategy being used, large systems such as OOPs are inherently complex to test and require large number of test cases to be designed.

• Creation of test cases is possibly the most difficult step in testing.

• To reduce the testing cost and effort and to achieve better quality software, automatic testing has become an urgent necessity.

Page 5: Generating test cases using UML Communication Diagram

5

• Automatic test case generation

- can reduce development cost by

eliminating costly manual test case

design effort &

- help increase reliability through

increased test coverage.

Page 6: Generating test cases using UML Communication Diagram

6

Current Relevance

• Software industries spend a huge amount of effort for testing their developed software.

• The proposed testing algorithms can be used by software industries to minimize the effort required for testing of very large object-oriented programs.

• The proposed testing algorithms can also be used in other disciplines such as electrical engineering, electronics and communication engineering etc. for testing of concerned software.

Page 7: Generating test cases using UML Communication Diagram

7

Motivation• Present-day software systems are basically object-

oriented due to several advantages.• Quality and effective reuse of software depends on

thorough testing. • Conventional testing methods are inadequate to

test object- oriented systems as it cannot address the issues related to O-O features such as inheritance, polymorphism etc.

• The O-O features such as inheritance, polymorphism etc. need to be considered carefully in the testing process.

• Hence, new methods and tools are to be developed for testing of O-O S/W.

Page 8: Generating test cases using UML Communication Diagram

8

Objectives

• The objective of the project would be to design & develop a tool for testing O-O S/W.

• This work would involve the following: • Design of a framework for automated

testing. The framework would be based on constructing an intermediate program graph representation.

Page 9: Generating test cases using UML Communication Diagram

9

• Automatically or semi-automatically generate test cases from an analysis of the constructed graph.

• Develop an effective GUI.

• Evaluate the performance of the proposed testing algorithms.

Page 10: Generating test cases using UML Communication Diagram

10

Testing of OOPs• Test cases are commonly designed based on

program source code. This makes test case generation difficult especially for testing at cluster levels.

• Further this approach proves to be inadequate in component-based software development, where the source code may not be available to the developers.

• It is therefore desirable to generate test cases automatically from the software design documents.

• Test generation from design documents has the added advantage of allowing test cases to be available early in the SDLC, thereby making test planning more effective.

Page 11: Generating test cases using UML Communication Diagram

11

• We concentrate upon automatically generating test cases based on communication diagrams.

• Communication diagrams represent both the messages passed between objects and their sequences.

• So, communication diagrams can provide both data flow and control flow infn.

• Data flow and control flow infn. have significant bearing on test case generation.

• Hence, using communication diagrams, it is possible to generate cluster level test cases even before any code is written.

Page 12: Generating test cases using UML Communication Diagram

12

• The first step will be constructing a communication tree from the commn. diagram.

• Then, we will iteratively select a predicate from this tree.

• We then transform this predicate to find the test data corresponding to the predicate.

• For each selected predicate, we then record test cases & the next predicate is selected for test generation.

• For each selected predicate, the transform predicate step & the generate test data step are repeated. The process continues till all predicates are considered .

Page 13: Generating test cases using UML Communication Diagram

13

Overview

Page 14: Generating test cases using UML Communication Diagram

14

Example

Page 15: Generating test cases using UML Communication Diagram

15

Example

Page 16: Generating test cases using UML Communication Diagram

16

Class diagram for generating test cases

Page 17: Generating test cases using UML Communication Diagram

17

• The important classes which will be used in our implementation are as follows:

• XmlBoundary class will be responsible for accepting a communication diagram in XML format. This class will display a prompt to user and will ask for a filename.

• TestCaseController class coordinates the different activities of the program.

Page 18: Generating test cases using UML Communication Diagram

18

• ElementFinder class uses the getElementsByTag-Name method of Element object to obtain the list of nodes inside parent node. Element is an interface of org.w3c.dom package. It represents an element in an HTML or XML document.

• DocumentParser class parses the XML file for the message names, arguments, sequence numbers etc. and constructs the communication tree.

Page 19: Generating test cases using UML Communication Diagram

19

• TestDataFinder uses the parsed information and finds the test data in the form of a string.

• TestCaseBoundary class is responsible for displaying the list of test cases for a communication diagram.

Page 20: Generating test cases using UML Communication Diagram

20

Summary • Develop a technique for automatic generation of test case

for OOPs.• Our technique will be based on an intermediate graph

representation. • We will use use-case diagrams, class diagrams, sequence

diagrams and collaboration diagrams for the testing purpose.

• Implement our algorithms using Java. • Analyze and compare the results.• Measure the performance of the algorithms.

Page 21: Generating test cases using UML Communication Diagram

21

Thank You

Page 22: Generating test cases using UML Communication Diagram

22

Program Slice

• Slice of a program w.r.t. program point p and variable x:

- All statements and predicates that might affect the value of x at point p.

• <p, x> known as slicing criterion.

Page 23: Generating test cases using UML Communication Diagram

23

Example1 main( )2 {3 int i, sum;4 sum = 0;5 i = 1;6 while(i <= 10)7 {8 Sum = sum + 1;9 ++ i;10 }11 printf(“%d”, sum);12 printf(“%d”, i);13 }

An Example Program & its slice w.r.t. <12, i>

Page 24: Generating test cases using UML Communication Diagram

• www.carrertime.in

• www.facebook.com/carrertime.in

24