blue’s support for object-oriented testing

25
Blue’s Support for Blue’s Support for Object-Oriented Object-Oriented Testing Testing By: By: James Majidian James Majidian Christopher Nersisyan Christopher Nersisyan

Upload: farrah

Post on 10-Feb-2016

69 views

Category:

Documents


1 download

DESCRIPTION

Blue’s Support for Object-Oriented Testing. By: James Majidian Christopher Nersisyan. Agenda. Abstract Introduction Reason for this article Object Oriented Testing Blue Environment Testing Conclusion Personal Thoughts Questions?. Abstract. Reasons for Object-Oriented testing: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Blue’s Support for Object-Oriented Testing

Blue’s Support for Blue’s Support for Object-Oriented TestingObject-Oriented Testing

By:By:James MajidianJames Majidian

Christopher NersisyanChristopher Nersisyan

Page 2: Blue’s Support for Object-Oriented Testing

AgendaAgenda AbstractAbstract IntroductionIntroduction Reason for this articleReason for this article Object Oriented TestingObject Oriented Testing Blue Environment TestingBlue Environment Testing ConclusionConclusion Personal ThoughtsPersonal Thoughts Questions?Questions?

Page 3: Blue’s Support for Object-Oriented Testing

AbstractAbstract Reasons for Object-Oriented testing:Reasons for Object-Oriented testing:

Object-Oriented programming is commonly Object-Oriented programming is commonly used for large scale projects. used for large scale projects. • Much research has been done on design and Much research has been done on design and

implementation, but minimal research on testing. implementation, but minimal research on testing.

By taking an object-oriented approach to By taking an object-oriented approach to testing, this presentation will show that testing, this presentation will show that with appropriate tools the cost of testing with appropriate tools the cost of testing will not be greatly increased. will not be greatly increased.

Page 4: Blue’s Support for Object-Oriented Testing

IntroductionIntroduction Reasons for Object-Oriented Large Scale Reasons for Object-Oriented Large Scale

SystemsSystems Excellent structuring mechanismExcellent structuring mechanism

• Units may be implemented separately.Units may be implemented separately. Implementation hidingImplementation hiding

• Internal structure of data may be hidden, and changes will Internal structure of data may be hidden, and changes will not affect users of the class, simplifying maintenance. not affect users of the class, simplifying maintenance.

Software reuseSoftware reuse• Reduction in the amount of software written improves Reduction in the amount of software written improves

reliability of system since tested classes may be reused. reliability of system since tested classes may be reused.

Page 5: Blue’s Support for Object-Oriented Testing

Introduction (Cont’d)Introduction (Cont’d) Difficulties of Object-Oriented TestingDifficulties of Object-Oriented Testing

Advantages of Object-Oriented Programming become Advantages of Object-Oriented Programming become disadvantagesdisadvantages

• AdvantagesAdvantages Excellent structuring mechanism. Excellent structuring mechanism. Implementation Hiding. Implementation Hiding.

• DisadvantagesDisadvantages Large number of individual units must be testedLarge number of individual units must be tested State of internal data not accessible via interfacesState of internal data not accessible via interfaces

Individual test cases must be developed for all unitsIndividual test cases must be developed for all units• Test cases must call each method supported by the class, prompt Test cases must call each method supported by the class, prompt

user for parameters and display results of method. user for parameters and display results of method. • Various combinations of these method calls must be exercised. Various combinations of these method calls must be exercised. • Resulting test program may be more complex and larger than Resulting test program may be more complex and larger than

the class being testedthe class being tested

Page 6: Blue’s Support for Object-Oriented Testing

Introduction (Cont’d)Introduction (Cont’d) Solutions for Object-Oriented Testing:Solutions for Object-Oriented Testing:

““Debug” print statementsDebug” print statements• AdvantagesAdvantages

Prints out relevant internal data.Prints out relevant internal data.• DisadvantagesDisadvantages

Could introduce new errors. Could introduce new errors. Large volume of output may become difficult to interpret. Large volume of output may become difficult to interpret.

Symbolic debuggerSymbolic debugger• AdvantagesAdvantages

Insert break points and examine data. Insert break points and examine data. • DisadvantagesDisadvantages

Adds complexity.Adds complexity. May not be able to display complex link structures. May not be able to display complex link structures.

BlueBlue

Page 7: Blue’s Support for Object-Oriented Testing

Introduction (Cont’d)Introduction (Cont’d) What is Blue?What is Blue?

Specifically designed for testing object-oriented Specifically designed for testing object-oriented applications.applications.

Graphical environment which supports interactive Graphical environment which supports interactive creation of instances of classes and interactive creation of instances of classes and interactive invocation of their methods. invocation of their methods.

Ability to examine the internal state variables of Ability to examine the internal state variables of objects.objects.

Allows the programmer to interactively test their Allows the programmer to interactively test their classes without writing a single line of test code.classes without writing a single line of test code.

Both an object-oriented programming language and Both an object-oriented programming language and development environment. development environment.

Page 8: Blue’s Support for Object-Oriented Testing

Reason for this articleReason for this article

Object Oriented programming is common Object Oriented programming is common method of programming, but limited method of programming, but limited information exists on testing it. information exists on testing it.

We felt that it would be beneficial to all to We felt that it would be beneficial to all to examine one method of Object Oriented examine one method of Object Oriented testing, the Blue environment.testing, the Blue environment.

Page 9: Blue’s Support for Object-Oriented Testing

Object Oriented TestingObject Oriented Testing

Procedure to test a class:Procedure to test a class: Create an instance of the classCreate an instance of the class Call of method of the objectCall of method of the object Examine the internal data of objectExamine the internal data of object

This can be achieved by the inclusion of This can be achieved by the inclusion of appropriate mechanisms in the program appropriate mechanisms in the program development environment.development environment.

Page 10: Blue’s Support for Object-Oriented Testing

Object Oriented Testing (cont’d)Object Oriented Testing (cont’d) Environment MechanismsEnvironment Mechanisms

Mechanism 1Mechanism 1• Interactively create an object of any class. Interactively create an object of any class. • Pass parameters to object. Pass parameters to object. • Once created, interactively invoke methods. Once created, interactively invoke methods. • Results are displayed.Results are displayed.

Mechanism 2Mechanism 2• Environment provides an inspection facility allowing internal data to Environment provides an inspection facility allowing internal data to

be examined.be examined.• Results are displayedResults are displayed

Characteristic of EnvironmentCharacteristic of Environment To support passing of objects, mechanisms must allow an To support passing of objects, mechanisms must allow an

arbitrary number of objects of arbitrary classes to be arbitrary number of objects of arbitrary classes to be constructed.constructed.

Page 11: Blue’s Support for Object-Oriented Testing

Blue Environment TestingBlue Environment Testing• Project Editor

• The empty area at the bottom of the main window is the object bench.

• Once a class within a project has been compiled, objects of that class may be created.

• Interactive creation of objects is achieved by selecting the class and clicking the “ Create” button.

• An instance is interactively created and available for operation.

• Invoking the creation operation on a class results in a normal object creation, including the execution of the creation routine (the ‘‘ constructor” in C++/Java terminology).

Page 12: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d) Object Creation DialogueObject Creation Dialogue

Appears after create operation is invokedAppears after create operation is invoked

Allows user to enter routine parameters. Allows user to enter routine parameters.

At the top of this dialogue, the interface of the At the top of this dialogue, the interface of the creation routine is displayed, with its header and creation routine is displayed, with its header and comment.comment.

Further down is a text field for entering parameter Further down is a text field for entering parameter values. values.

Under the parameters is another field to provide a Under the parameters is another field to provide a name for the object to be created.name for the object to be created.

The large empty area in the middle of the dialogue The large empty area in the middle of the dialogue

provides a list of previously used parameters. It is provides a list of previously used parameters. It is provided for convenience during testing of a class.provided for convenience during testing of a class.

• Previously made calls can be easily repeated by Previously made calls can be easily repeated by selecting a parameter combination from the list.selecting a parameter combination from the list.

Page 13: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d)

An object on the “Object Bench”An object on the “Object Bench” Once the OK button is clicked in the dialogue Once the OK button is clicked in the dialogue

the object is created and displayed on the object the object is created and displayed on the object bench. bench.

The object is then available to the user forThe object is then available to the user for direct direct interaction. interaction.

Page 14: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d)

Calling a routine on an objectCalling a routine on an object Clicking on the object with the right mouse button displays a Clicking on the object with the right mouse button displays a

menu that includes all interface routines of that objectmenu that includes all interface routines of that object. .

Also included in the menu are two special operations available Also included in the menu are two special operations available for all objects: for all objects: inspect inspect and and remove. remove.

Page 15: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d) Symbols in the routine Symbols in the routine

menu indicate whether a menu indicate whether a routine has parameters or routine has parameters or return values. return values.

If the routine has If the routine has parameters, a parameter parameters, a parameter dialogue similar to the one dialogue similar to the one seen at the creation of the seen at the creation of the object is displayedobject is displayed

On the click of the OK On the click of the OK button the routine is button the routine is executed and, if the executed and, if the routine returns results, the routine returns results, the result values are result values are displayed in another displayed in another dialogue.dialogue.

Page 16: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d)

How interactive creation helps:How interactive creation helps: There is no need to complete all classes in a There is no need to complete all classes in a

project before the first tests can be performed. project before the first tests can be performed.

Each class can be tested as soon as some of Each class can be tested as soon as some of its routines have been completed.its routines have been completed.• No need to write special purpose test code. No need to write special purpose test code.

Page 17: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d)

CompositionComposition During the interactive testing of the system, During the interactive testing of the system,

objects accessible on the object bench may objects accessible on the object bench may be composed. be composed. • i.e. one object may be passed as a parameter to i.e. one object may be passed as a parameter to

the routine of another object. the routine of another object.

Page 18: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d) Inspection of ObjectsInspection of Objects

Inspect operationInspect operation• Allows viewing of instance data of objects that don’t provide Allows viewing of instance data of objects that don’t provide

accessor functions.accessor functions.• Results are displayed graphically.Results are displayed graphically.

Get places object on object bench to be examined later.Get places object on object bench to be examined later. Inspect opens another dialogue for Instance variable inspection.Inspect opens another dialogue for Instance variable inspection.

Inspections allow users to observe the effect of routine execution Inspections allow users to observe the effect of routine execution of internal data.of internal data.

Page 19: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d)

Record FacilityRecord Facility• Textually records all interactive object creations, Textually records all interactive object creations,

method invocations, return values, text input and method invocations, return values, text input and text output.text output.

• This helps with test documentation.This helps with test documentation.

Page 20: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d) Pedagogical BenefitsPedagogical Benefits

Blue environment was initially developed as a teaching environment for first year students.Blue environment was initially developed as a teaching environment for first year students. Benefits as a teaching aid:Benefits as a teaching aid:

• Incremental developmentIncremental development No need to syntactically complete a whole applicationNo need to syntactically complete a whole application As soon as one class or routine is completed it can be compiled, and objects can As soon as one class or routine is completed it can be compiled, and objects can

be created, executed, and tested. be created, executed, and tested. Leads to greater motivation and earlier error detection (which is also beneficial for Leads to greater motivation and earlier error detection (which is also beneficial for

professional development).professional development).• Class/object distinction. Class/object distinction.

Allowing the direct creation of and interaction with objects greatly facilitates Allowing the direct creation of and interaction with objects greatly facilitates understanding.understanding.

If a student has a class “Person” and creates three different people with different If a student has a class “Person” and creates three different people with different names, the role of the class and the role of each object becomes much more names, the role of the class and the role of each object becomes much more directly understandable.directly understandable.

• Programming without I/OProgramming without I/O Allows a clearer understanding of the abstraction concepts if routine calls are Allows a clearer understanding of the abstraction concepts if routine calls are

taught before language exceptionstaught before language exceptions• Interface/implementation distinctionInterface/implementation distinction• Testing supportTesting support

As was the goal of Blue, good testing is supported much better than in As was the goal of Blue, good testing is supported much better than in conventional systems. conventional systems.

Page 21: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d)

ImplementationImplementation A shell Blue class will be created and its A shell Blue class will be created and its

constructor will hold the interactive call.constructor will hold the interactive call. When the shell class is compiled and When the shell class is compiled and

executed, the interactive calls will be executed, the interactive calls will be performed.performed.

This shell class will store the interval object’s This shell class will store the interval object’s values and this data will be shown in the values and this data will be shown in the result dialogue box.result dialogue box.

Page 22: Blue’s Support for Object-Oriented Testing

Blue Environment Testing (cont’d)Blue Environment Testing (cont’d)

Interactive call under testing.Interactive call under testing.

Blue Shell Source CodeBlue Shell Source Code

Page 23: Blue’s Support for Object-Oriented Testing

ConclusionConclusion Object Oriented programming has great Object Oriented programming has great

advantages to software development, but advantages to software development, but creates difficulties in testing. creates difficulties in testing.

Blue has been designed to aid in testing Object Blue has been designed to aid in testing Object Oriented programs, by reducing special purpose Oriented programs, by reducing special purpose test code.test code.

Blue supports incremental testing to occur early Blue supports incremental testing to occur early in the project, aiding the stability of the in the project, aiding the stability of the application.application.

Blue was created to aid teaching languages, and Blue was created to aid teaching languages, and should be available online today.should be available online today.

Page 24: Blue’s Support for Object-Oriented Testing

Personal ThoughtsPersonal Thoughts Its simplicity seems more detrimental than Its simplicity seems more detrimental than

beneficial.beneficial. Blue may be an effective tool for simple Blue may be an effective tool for simple

unit testing, but seems too elementary for unit testing, but seems too elementary for industry use.industry use.

First year students taught in the Blue First year students taught in the Blue environment may have trouble environment may have trouble transitioning to actual programming transitioning to actual programming environments. environments.

Page 25: Blue’s Support for Object-Oriented Testing

Any Questions?Any Questions?