SlideShare a Scribd company logo
1 of 22
TESTING OBJECT ORIENTED
SOFTWARE
UNIT 3
INRODUCTION
Previously computer program was nothing but just a list of commands called functions
where all data getting stored in one single location which creates problem in testing the
program properly. Object-oriented testing and traditional testing are similar in few
aspects. Like we use unit testing, we perform integration testing to make sure all
subsystems work correctly, we perform system testing to make sure software meets the
specified requirements. Object-oriented programming language has features like
inheritance, polymorphism which is completely new and brought technical challenges for
tester while testing.
NEED OF TESTING
Testing is a merry-go-round process which includes a good amount of time along with cost, for all. But
the reality is quite opposite, without testing it is not possible to deliver projects successfully, as during
software development, developers make many mistakes throughout the different phase of
development and testing helps in correcting those mistakes. In other way, testing encompasses all
phases of development-in every phase; the work products of that phase are tested. So in every phase
of development there is testing activity. For example, in the requirement engineering stage, the SRS
(System Requirement Specification ) document is written and tested to check whether it captures all
the user requirements or not. The same is applicable for object oriented testing as object-oriented
programming increases software reusability, extensibility, interoperability, and reliability and at the
same time it is necessary to realize these benefits by uncovering as many programming errors as
possible.
WHAT TESTING IS AND ISN’T
Testing comprises the efforts to find defects. Testing does not include efforts
associated with tracking down bugs and fixing them. In other words, testing
does not include the debugging or repair of bugs. Testing is a procedure of
finding faults, defects in the software. While debugging is to rectify the faults,
defects find during testing in the software.
PROBLEM AND CHALLENGES
The object-oriented paradigm has set of testing and maintenance problems. The inheritance, aggregation and
association relationships among the object classes make an OO program difficult to test. The encapsulation and
information hiding features result in chains of member function invocations that often involve objects of more than
one class. The problems for software testing are:
1. It is difficult to understand the code and prepare the test cases.
2. It is not cost-effective to construct test stubs for member functions since most of them consist of one to two
statements. Rather, one would just use them provided that they have been tested.
3. It is necessary to determine and limit the required regression tests when a function or a class is changed.
4. It requires a fresh look into the traditional coverage criteria and to extend them to include not just coverage of
individual functions, but also invocation sequence, object stated and state sequences, and data definition and
use path across functions and objects.
DIFFERENCES FROM TESTING NON-OBJECT ORIENTED
SOFTWARE
• Conventional testing defined for procedural programs do not fit well in the case of testing an object-oriented
program.
• Conventional software testing tends to focus much on the algorithmic detail of a module and the data that
flows across the module interface, whereas object-oriented software tends to focus on the operations that are
encapsulated by the class and the state behavior of the class.
• Several object-oriented features such as data abstraction, inheritance, polymorphism, dynamic binding etc.,
heavily impact on testing that is not straightforward to make object-oriented systems fit the conventional
testing levels.
• There arises the need for object-oriented testing techniques which suits for object oriented system Though
objects and agents have some similarities, they also differ widely.
• Agents can be termed as intelligent object as agents possesses certain unique properties such as autonomy,
pro-activity, reactivity, social ability etc., the studies states that the agent oriented software are currently been
tested by using the existing object-oriented testing techniques, upon mapping of agent-oriented abstractions
into object-oriented constructs. However agent properties such as autonomy, pro-activity, reactivity etc.,
cannot be mapped into object-oriented constructs. There arises the need for agent-oriented testing
techniques for agent-oriented system
TESTING OBJECT–ORIENTED CLASSES
• This fact is demonstrated by the different approaches to testing classes.
Classes contain methods and object instances. Each object instance
represents another state. The methods may also have multiple paths through
them, for instance in the case of decision statements and loops. In testing
procedural units, i.e. modules, one was aiming at traversing every path
through the module.
• In testing object-oriented units, i.e. classes, one also has to deal with state.
Not only that, but since individual methods can be invoked from outside, one
must test every potential chain of methods, from entry to exit.
BINDER HAS POINTED OUT FOUR APPROACHES TO
CLASS TESTING/ CLASS MODALITY
• Non modal
• Uni Modal
• Quassi Model
• Modal
APPROACHES TO CLASS TESTING
APPROACHES TO CLASS TESTING CONTD..
• Non modal means testing every single method with a single object instance.
• Uni modal means testing every combination of methods with a single object instance.
• Quasi modal implies testing individual methods with multiple object instances
• and modal implies testing every combination of methods with multiple object instances, e.g. all
possible object states.
• On top of this comes the conventional challenge of testing every path through a method. The result
of combining paths, with methods, with states leads to a combinational explosion of potential test
cases. The only way to deal with this is by automatically generating the test cases out of the code
and joining these test cases with those derived from the class specification. Without the support of
automated class test beds there is no way to test complex classes. Tools like JUnit, CPPTest and
NetUnit can fulfill this need if used correctly..
STATE-BASED TESTING TECHNIQUES
One commonly used testing technique is to analyze the different abstract states that a class can
take. The state of an object is generally defined as a constraint on the values of its attributes.
According to the state of the object, calls to certain methods may or may not be valid, or the
method's behavior may change. Generally speaking, the process of using state-based testing
techniques is as follows:
• Define the states.
• Define the transitions between states.
• Define test scenarios.
• Define test values for each state.
TO SEE HOW THIS WORKS, CONSIDER THE MONEYBAG CLASS FROM JUNIT.
class MoneyBag implements IMoney {
private Vector fMonies= new Vector(5);
public IMoney add(IMoney m) {
return m.addMoneyBag(this);
}
public IMoney addMoney(Money m) {
return MoneyBag.create(m, this);
}
public IMoney addMoneyBag(MoneyBag s) {
return MoneyBag.create(s, this);
}
void appendMoney(Money aMoney) {
if (aMoney.isZero()) return;
}
IMoney old= findMoney(aMoney.currency());
if (old == null) {
fMonies.addElement(aMoney);
return; }
fMonies.removeElement(old);
IMoney sum= old.add(aMoney);
if (sum.isZero())
return;
fMonies.addElement(sum);
private Money findMoney(String currency)
{
for (Enumeration e=fMonies.elements();e.hasMoreElements();)
{
Money m= (Money) e.nextElement();
if (m.currency().equals(currency))
return m;
}
return null;
}
private boolean contains(Money m) {
Money found= findMoney(m.currency());
if (found == null) return false;
return found.amount() == m.amount();
}
}
DEFINE STATES
• The first step in using state-based testing techniques is to define the states. From the second line in the code, you can see that the
MoneyBag class can hold from 0 to 5 Money objects.
private Vector fMonies= new Vector(5);
• From this analysis, you can create a state model with the following states:
• EmptyBag
• PartiallyFullBag
• FullBag
• In this example, you can define the following constraints on the fMonies attribute, as shown in the following table:
• Although it is not always necessary to formally define these states, it can be useful when you are defining test data, or if you want to
check the object state during a specific scenario.
State Constraint
EmptyBag fMonies.size()==0
PartiallyFullBag (fMonies.size()>0) && (fMonies.size()<5)
FullBag fMonies.size()==5
DEFINE TRANSITIONS BETWEEN STATES
• The next step is to define the possible transitions between states and determine what triggers a transition from one
state to another. Generally, when you test a class, a transition is triggered when a method is invoked. For example,
the transition from the EmptyBag state to the PartiallyFullBag state is triggered by a call to appendMoney.
• Thus, some possible transitions could be defined as follows:
• A transition from the EmptyBag state to the PartiallyFullBag state (appendMoney).
• A transition from the EmptyBag state to the FullBag state in the case where appendBag is called with a bag containing 5 Money
objects. [aBag.size()==5]/appendBag(aBag).
• A transition from the PartiallyFullBag state to the FullBag state in the case where appendMoney is called on a bag already
containing 4 Money objects [fMonies.size()==4]/appendMoney
• To summarize, for each identified state, you should list:
• Valid actions (transitions) and their effects, that is, whether or not there is a change of state
• Invalid actions that should produce an exception
DEFINE TEST SCENARIOS
• Tests generally consist of scenarios that exercise the object along a given path through the state machine. Since the
number of possible paths in the state machine is generally infinite, it is not practical to test each possible path.
Instead, you should make sure that you do the following tasks:
• Cover all identified states at least once.
• Cover all valid transitions at least once.
• Trigger all invalid transitions at least once
• Whenever possible, check the state of the object that you are testing throughout the scenario to ensure that the
theoretical state model you have defined is actually the one implemented by the class you are testing. After you
finish with these transitions, you can test for robustness by calling methods in a random sequence and checking that
a class invariant is never violated. For instance, the MoneyBag class should always be a set of Money objects that are
never of the same currency.
• You can use the scenario-based test pattern that is included with the product to create test scenarios.
DEFINE TEST VALUES FOR EACH STATE
• Finally, you need to choose test values for each individual state. Choose unique test values and do not
reuse values that you have used previously in the context of other tests. This strategy provides more
diversity in your test suite and increases the likelihood of detecting bugs.
MESSAGE SEQUENCE SPECIFICATION/ MESSAGE
SEQUENCE CHART
• message sequence chart (or MSC) is an interaction diagram by the International Telecommunication
Union.
• The purpose of recommending MSC (Message Sequence Chart) is to provide a trace language for the
specification and description of the communication behavior of system components and their
environment by means of message interchange. Since in MSCs the communication behavior is presented
in a very intuitive and transparent manner, particularly in the graphical representation, the MSC language
is easy to learn, use and interpret. In connection with other languages it can be used to support
methodologies for system specification, design, simulation, testing, and documentation.
• The first version of the MSC standard was released in March 12, 1993.
• The 1996 version added references, ordering and inlining expressions concepts, and introduced HMSC
(High-level Message Sequence Charts), which are the MSC way of expressing State diagrams.
• The MSC 2000 version added object orientation, refined the use of data and time in diagrams, and added
the concept of remote method calls.
EXAMPLE
• The diagram shows three entities. At start the phone is disconnected. A user
tries to establish a connection. A connection request is sent to the switch and
a timer is started. An alternative deals with two possible responses:
1. The timer goes off because the switch did not reply and the phone goes
back to the disconnected state.
2. The switch grants the connection and the call is established.
COMPARISON TO UML
• UML Sequence Diagram looks very similar to the ITU-T MSC but the default basic principles are quite different:
• Lifelines
• In an MSC, the vertical lines are autonomous execution entities. They usually represent state machines executing in parallel. The
state machines need not be on the same computer.
• In a Sequence Diagram, a vertical line is usually an object. The object can be active (in its own thread of execution) or passive (in
the execution context of an active object).
• Arrows
• In an MSC an arrow is usually an asynchronous message sent from one entity to another one. Once the message is sent the
sending entity resumes its execution.
• In a Sequence Diagram an arrow is usually understood as an operation call on a class. It is therefore synchronous and the calling
entity hangs until the operation returns.
• It has been said that MSC has been considered as a candidate for the interaction diagrams in UML.
• However, proponents of MSC such as Ericsson think that MSC is better than UML 2.0 for modelling large or complex
systems.
LIVE SEQUENCE CHARTS
• David Harel thinks that MSC still has several shortcomings such as:
• MSC propose a weak partial ordering semantics that makes it impossible
to capture some behavioral requirements,
• The relationship between the MSC requirements and the executable
specification is not clear.
• To address what he sees as weaknesses in the MSC model, David Harel
proposed an extension on the MSC standard called LSC (Live Sequence
Charts).
End

More Related Content

What's hot

System testing
System testingSystem testing
System testingSlideshare
 
Manual testing concepts course 1
Manual testing concepts course 1Manual testing concepts course 1
Manual testing concepts course 1Raghu Kiran
 
software Prototyping model
software Prototyping modelsoftware Prototyping model
software Prototyping modelSankeerthanaS1
 
Software Testing Strategies
Software Testing StrategiesSoftware Testing Strategies
Software Testing StrategiesAdeel Rasheed
 
Quality Assurance and Software Testing
Quality Assurance and Software TestingQuality Assurance and Software Testing
Quality Assurance and Software Testingpingkapil
 
System testing ppt
System testing pptSystem testing ppt
System testing pptL ESHWAR
 
ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2Chandukar
 
Interview questions for manual testing technology.
Interview questions for manual testing technology.Interview questions for manual testing technology.
Interview questions for manual testing technology.Vinay Agnihotri
 
ISTQB - What's testing
ISTQB - What's testingISTQB - What's testing
ISTQB - What's testingHoangThiHien1
 
Software Engineering- Types of Testing
Software Engineering- Types of TestingSoftware Engineering- Types of Testing
Software Engineering- Types of TestingTrinity Dwarka
 
software testing for beginners
software testing for beginnerssoftware testing for beginners
software testing for beginnersBharathi Ashok
 
Chapter 2 - Testing Throughout the Development LifeCycle
Chapter 2 - Testing Throughout the Development LifeCycleChapter 2 - Testing Throughout the Development LifeCycle
Chapter 2 - Testing Throughout the Development LifeCycleNeeraj Kumar Singh
 
Testing concepts ppt
Testing concepts pptTesting concepts ppt
Testing concepts pptRathna Priya
 
Fundamentals of Software Testing
Fundamentals of Software TestingFundamentals of Software Testing
Fundamentals of Software TestingSagar Joshi
 

What's hot (20)

System testing
System testingSystem testing
System testing
 
Manual testing concepts course 1
Manual testing concepts course 1Manual testing concepts course 1
Manual testing concepts course 1
 
software Prototyping model
software Prototyping modelsoftware Prototyping model
software Prototyping model
 
Software Testing Strategies
Software Testing StrategiesSoftware Testing Strategies
Software Testing Strategies
 
Testing methodology
Testing methodologyTesting methodology
Testing methodology
 
Quality Assurance and Software Testing
Quality Assurance and Software TestingQuality Assurance and Software Testing
Quality Assurance and Software Testing
 
System testing ppt
System testing pptSystem testing ppt
System testing ppt
 
Introduction & Manual Testing
Introduction & Manual TestingIntroduction & Manual Testing
Introduction & Manual Testing
 
Test plan
Test planTest plan
Test plan
 
ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2ISTQB Foundation - Chapter 2
ISTQB Foundation - Chapter 2
 
Interview questions for manual testing technology.
Interview questions for manual testing technology.Interview questions for manual testing technology.
Interview questions for manual testing technology.
 
ISTQB - What's testing
ISTQB - What's testingISTQB - What's testing
ISTQB - What's testing
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Software Engineering- Types of Testing
Software Engineering- Types of TestingSoftware Engineering- Types of Testing
Software Engineering- Types of Testing
 
software testing for beginners
software testing for beginnerssoftware testing for beginners
software testing for beginners
 
Types of testing
Types of testingTypes of testing
Types of testing
 
Chapter 2 - Testing Throughout the Development LifeCycle
Chapter 2 - Testing Throughout the Development LifeCycleChapter 2 - Testing Throughout the Development LifeCycle
Chapter 2 - Testing Throughout the Development LifeCycle
 
Testing concepts ppt
Testing concepts pptTesting concepts ppt
Testing concepts ppt
 
Fundamentals of Software Testing
Fundamentals of Software TestingFundamentals of Software Testing
Fundamentals of Software Testing
 
Software Testing
Software TestingSoftware Testing
Software Testing
 

Similar to Testing object oriented software.pptx

Quality assurance tests
Quality assurance testsQuality assurance tests
Quality assurance testsamitzore
 
Software testing part
Software testing partSoftware testing part
Software testing partPreeti Mishra
 
Java Unit Test - JUnit
Java Unit Test - JUnitJava Unit Test - JUnit
Java Unit Test - JUnitAktuğ Urun
 
types of testing with descriptions and examples
types of testing with descriptions and examplestypes of testing with descriptions and examples
types of testing with descriptions and examplesMani Deepak Choudhry
 
Software Testing strategies, their types and Levels
Software Testing strategies, their types and LevelsSoftware Testing strategies, their types and Levels
Software Testing strategies, their types and Levelsranapoonam1
 
Unit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile AppsUnit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile AppsMarcelo Busico
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit designSoftware engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit designMaitree Patel
 
Generating Test Cases
Generating Test CasesGenerating Test Cases
Generating Test CasesVivekRajawat9
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Deepak Singhvi
 
Dynamic analysis in Software Testing
Dynamic analysis in Software TestingDynamic analysis in Software Testing
Dynamic analysis in Software TestingSagar Pednekar
 
Chapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringChapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringAnasHassan52
 
Software testing introduction
Software testing introductionSoftware testing introduction
Software testing introductionSriman Eshwar
 
CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4SIMONTHOMAS S
 

Similar to Testing object oriented software.pptx (20)

Quality assurance tests
Quality assurance testsQuality assurance tests
Quality assurance tests
 
software testing
software testingsoftware testing
software testing
 
Software testing part
Software testing partSoftware testing part
Software testing part
 
Java Unit Test - JUnit
Java Unit Test - JUnitJava Unit Test - JUnit
Java Unit Test - JUnit
 
Software Testing
Software Testing Software Testing
Software Testing
 
Testing
TestingTesting
Testing
 
types of testing with descriptions and examples
types of testing with descriptions and examplestypes of testing with descriptions and examples
types of testing with descriptions and examples
 
Software Testing strategies, their types and Levels
Software Testing strategies, their types and LevelsSoftware Testing strategies, their types and Levels
Software Testing strategies, their types and Levels
 
testing
testingtesting
testing
 
Unit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile AppsUnit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile Apps
 
Software engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit designSoftware engineering Testing technique,test case,test suit design
Software engineering Testing technique,test case,test suit design
 
Generating Test Cases
Generating Test CasesGenerating Test Cases
Generating Test Cases
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.
 
Dynamic analysis in Software Testing
Dynamic analysis in Software TestingDynamic analysis in Software Testing
Dynamic analysis in Software Testing
 
Chapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineeringChapter 8 Testing Tactics.ppt Software engineering
Chapter 8 Testing Tactics.ppt Software engineering
 
Testing
TestingTesting
Testing
 
Software testing introduction
Software testing introductionSoftware testing introduction
Software testing introduction
 
Unit2 for st
Unit2 for stUnit2 for st
Unit2 for st
 
Chapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.pptChapter 8 Testing Tactics.ppt
Chapter 8 Testing Tactics.ppt
 
CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4
 

More from DRPOONAMDRPOONAM1 (8)

1_ICT.pdf
1_ICT.pdf1_ICT.pdf
1_ICT.pdf
 
8_MS.pptx
8_MS.pptx8_MS.pptx
8_MS.pptx
 
geospatial technology.pptx
geospatial technology.pptxgeospatial technology.pptx
geospatial technology.pptx
 
Internt.ppt
Internt.pptInternt.ppt
Internt.ppt
 
L02.ppt
L02.pptL02.ppt
L02.ppt
 
L01.pdf
L01.pdfL01.pdf
L01.pdf
 
ms_word.pdf
ms_word.pdfms_word.pdf
ms_word.pdf
 
lec01.pdf
lec01.pdflec01.pdf
lec01.pdf
 

Recently uploaded

Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Ramkumar k
 
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书c3384a92eb32
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdfAlexander Litvinenko
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfKira Dess
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...archanaece3
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfJNTUA
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisDr.Costas Sachpazis
 
Geometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfGeometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfJNTUA
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...josephjonse
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...IJECEIAES
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfSkNahidulIslamShrabo
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...Amil baba
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsMathias Magdowski
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashidFaiyazSheikh
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationEmaan Sharma
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docxrahulmanepalli02
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptamrabdallah9
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Studentskannan348865
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentationsj9399037128
 

Recently uploaded (20)

Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
一比一原版(Griffith毕业证书)格里菲斯大学毕业证成绩单学位证书
 
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdflitvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
litvinenko_Henry_Intrusion_Hong-Kong_2024.pdf
 
Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...5G and 6G refer to generations of mobile network technology, each representin...
5G and 6G refer to generations of mobile network technology, each representin...
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
Geometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdfGeometric constructions Engineering Drawing.pdf
Geometric constructions Engineering Drawing.pdf
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdf
 
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
NO1 Best Powerful Vashikaran Specialist Baba Vashikaran Specialist For Love V...
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded Systems
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & Modernization
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.ppt
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentation
 

Testing object oriented software.pptx

  • 2. INRODUCTION Previously computer program was nothing but just a list of commands called functions where all data getting stored in one single location which creates problem in testing the program properly. Object-oriented testing and traditional testing are similar in few aspects. Like we use unit testing, we perform integration testing to make sure all subsystems work correctly, we perform system testing to make sure software meets the specified requirements. Object-oriented programming language has features like inheritance, polymorphism which is completely new and brought technical challenges for tester while testing.
  • 3. NEED OF TESTING Testing is a merry-go-round process which includes a good amount of time along with cost, for all. But the reality is quite opposite, without testing it is not possible to deliver projects successfully, as during software development, developers make many mistakes throughout the different phase of development and testing helps in correcting those mistakes. In other way, testing encompasses all phases of development-in every phase; the work products of that phase are tested. So in every phase of development there is testing activity. For example, in the requirement engineering stage, the SRS (System Requirement Specification ) document is written and tested to check whether it captures all the user requirements or not. The same is applicable for object oriented testing as object-oriented programming increases software reusability, extensibility, interoperability, and reliability and at the same time it is necessary to realize these benefits by uncovering as many programming errors as possible.
  • 4. WHAT TESTING IS AND ISN’T Testing comprises the efforts to find defects. Testing does not include efforts associated with tracking down bugs and fixing them. In other words, testing does not include the debugging or repair of bugs. Testing is a procedure of finding faults, defects in the software. While debugging is to rectify the faults, defects find during testing in the software.
  • 5. PROBLEM AND CHALLENGES The object-oriented paradigm has set of testing and maintenance problems. The inheritance, aggregation and association relationships among the object classes make an OO program difficult to test. The encapsulation and information hiding features result in chains of member function invocations that often involve objects of more than one class. The problems for software testing are: 1. It is difficult to understand the code and prepare the test cases. 2. It is not cost-effective to construct test stubs for member functions since most of them consist of one to two statements. Rather, one would just use them provided that they have been tested. 3. It is necessary to determine and limit the required regression tests when a function or a class is changed. 4. It requires a fresh look into the traditional coverage criteria and to extend them to include not just coverage of individual functions, but also invocation sequence, object stated and state sequences, and data definition and use path across functions and objects.
  • 6. DIFFERENCES FROM TESTING NON-OBJECT ORIENTED SOFTWARE • Conventional testing defined for procedural programs do not fit well in the case of testing an object-oriented program. • Conventional software testing tends to focus much on the algorithmic detail of a module and the data that flows across the module interface, whereas object-oriented software tends to focus on the operations that are encapsulated by the class and the state behavior of the class. • Several object-oriented features such as data abstraction, inheritance, polymorphism, dynamic binding etc., heavily impact on testing that is not straightforward to make object-oriented systems fit the conventional testing levels. • There arises the need for object-oriented testing techniques which suits for object oriented system Though objects and agents have some similarities, they also differ widely. • Agents can be termed as intelligent object as agents possesses certain unique properties such as autonomy, pro-activity, reactivity, social ability etc., the studies states that the agent oriented software are currently been tested by using the existing object-oriented testing techniques, upon mapping of agent-oriented abstractions into object-oriented constructs. However agent properties such as autonomy, pro-activity, reactivity etc., cannot be mapped into object-oriented constructs. There arises the need for agent-oriented testing techniques for agent-oriented system
  • 7. TESTING OBJECT–ORIENTED CLASSES • This fact is demonstrated by the different approaches to testing classes. Classes contain methods and object instances. Each object instance represents another state. The methods may also have multiple paths through them, for instance in the case of decision statements and loops. In testing procedural units, i.e. modules, one was aiming at traversing every path through the module. • In testing object-oriented units, i.e. classes, one also has to deal with state. Not only that, but since individual methods can be invoked from outside, one must test every potential chain of methods, from entry to exit.
  • 8. BINDER HAS POINTED OUT FOUR APPROACHES TO CLASS TESTING/ CLASS MODALITY • Non modal • Uni Modal • Quassi Model • Modal
  • 10. APPROACHES TO CLASS TESTING CONTD.. • Non modal means testing every single method with a single object instance. • Uni modal means testing every combination of methods with a single object instance. • Quasi modal implies testing individual methods with multiple object instances • and modal implies testing every combination of methods with multiple object instances, e.g. all possible object states. • On top of this comes the conventional challenge of testing every path through a method. The result of combining paths, with methods, with states leads to a combinational explosion of potential test cases. The only way to deal with this is by automatically generating the test cases out of the code and joining these test cases with those derived from the class specification. Without the support of automated class test beds there is no way to test complex classes. Tools like JUnit, CPPTest and NetUnit can fulfill this need if used correctly..
  • 11. STATE-BASED TESTING TECHNIQUES One commonly used testing technique is to analyze the different abstract states that a class can take. The state of an object is generally defined as a constraint on the values of its attributes. According to the state of the object, calls to certain methods may or may not be valid, or the method's behavior may change. Generally speaking, the process of using state-based testing techniques is as follows: • Define the states. • Define the transitions between states. • Define test scenarios. • Define test values for each state.
  • 12. TO SEE HOW THIS WORKS, CONSIDER THE MONEYBAG CLASS FROM JUNIT. class MoneyBag implements IMoney { private Vector fMonies= new Vector(5); public IMoney add(IMoney m) { return m.addMoneyBag(this); } public IMoney addMoney(Money m) { return MoneyBag.create(m, this); } public IMoney addMoneyBag(MoneyBag s) { return MoneyBag.create(s, this); } void appendMoney(Money aMoney) { if (aMoney.isZero()) return; } IMoney old= findMoney(aMoney.currency()); if (old == null) { fMonies.addElement(aMoney); return; } fMonies.removeElement(old); IMoney sum= old.add(aMoney); if (sum.isZero()) return; fMonies.addElement(sum); private Money findMoney(String currency) { for (Enumeration e=fMonies.elements();e.hasMoreElements();) { Money m= (Money) e.nextElement(); if (m.currency().equals(currency)) return m; } return null; } private boolean contains(Money m) { Money found= findMoney(m.currency()); if (found == null) return false; return found.amount() == m.amount(); } }
  • 13. DEFINE STATES • The first step in using state-based testing techniques is to define the states. From the second line in the code, you can see that the MoneyBag class can hold from 0 to 5 Money objects. private Vector fMonies= new Vector(5); • From this analysis, you can create a state model with the following states: • EmptyBag • PartiallyFullBag • FullBag • In this example, you can define the following constraints on the fMonies attribute, as shown in the following table: • Although it is not always necessary to formally define these states, it can be useful when you are defining test data, or if you want to check the object state during a specific scenario. State Constraint EmptyBag fMonies.size()==0 PartiallyFullBag (fMonies.size()>0) && (fMonies.size()<5) FullBag fMonies.size()==5
  • 14. DEFINE TRANSITIONS BETWEEN STATES • The next step is to define the possible transitions between states and determine what triggers a transition from one state to another. Generally, when you test a class, a transition is triggered when a method is invoked. For example, the transition from the EmptyBag state to the PartiallyFullBag state is triggered by a call to appendMoney. • Thus, some possible transitions could be defined as follows: • A transition from the EmptyBag state to the PartiallyFullBag state (appendMoney). • A transition from the EmptyBag state to the FullBag state in the case where appendBag is called with a bag containing 5 Money objects. [aBag.size()==5]/appendBag(aBag). • A transition from the PartiallyFullBag state to the FullBag state in the case where appendMoney is called on a bag already containing 4 Money objects [fMonies.size()==4]/appendMoney • To summarize, for each identified state, you should list: • Valid actions (transitions) and their effects, that is, whether or not there is a change of state • Invalid actions that should produce an exception
  • 15. DEFINE TEST SCENARIOS • Tests generally consist of scenarios that exercise the object along a given path through the state machine. Since the number of possible paths in the state machine is generally infinite, it is not practical to test each possible path. Instead, you should make sure that you do the following tasks: • Cover all identified states at least once. • Cover all valid transitions at least once. • Trigger all invalid transitions at least once • Whenever possible, check the state of the object that you are testing throughout the scenario to ensure that the theoretical state model you have defined is actually the one implemented by the class you are testing. After you finish with these transitions, you can test for robustness by calling methods in a random sequence and checking that a class invariant is never violated. For instance, the MoneyBag class should always be a set of Money objects that are never of the same currency. • You can use the scenario-based test pattern that is included with the product to create test scenarios.
  • 16. DEFINE TEST VALUES FOR EACH STATE • Finally, you need to choose test values for each individual state. Choose unique test values and do not reuse values that you have used previously in the context of other tests. This strategy provides more diversity in your test suite and increases the likelihood of detecting bugs.
  • 17. MESSAGE SEQUENCE SPECIFICATION/ MESSAGE SEQUENCE CHART • message sequence chart (or MSC) is an interaction diagram by the International Telecommunication Union. • The purpose of recommending MSC (Message Sequence Chart) is to provide a trace language for the specification and description of the communication behavior of system components and their environment by means of message interchange. Since in MSCs the communication behavior is presented in a very intuitive and transparent manner, particularly in the graphical representation, the MSC language is easy to learn, use and interpret. In connection with other languages it can be used to support methodologies for system specification, design, simulation, testing, and documentation. • The first version of the MSC standard was released in March 12, 1993. • The 1996 version added references, ordering and inlining expressions concepts, and introduced HMSC (High-level Message Sequence Charts), which are the MSC way of expressing State diagrams. • The MSC 2000 version added object orientation, refined the use of data and time in diagrams, and added the concept of remote method calls.
  • 18.
  • 19. EXAMPLE • The diagram shows three entities. At start the phone is disconnected. A user tries to establish a connection. A connection request is sent to the switch and a timer is started. An alternative deals with two possible responses: 1. The timer goes off because the switch did not reply and the phone goes back to the disconnected state. 2. The switch grants the connection and the call is established.
  • 20. COMPARISON TO UML • UML Sequence Diagram looks very similar to the ITU-T MSC but the default basic principles are quite different: • Lifelines • In an MSC, the vertical lines are autonomous execution entities. They usually represent state machines executing in parallel. The state machines need not be on the same computer. • In a Sequence Diagram, a vertical line is usually an object. The object can be active (in its own thread of execution) or passive (in the execution context of an active object). • Arrows • In an MSC an arrow is usually an asynchronous message sent from one entity to another one. Once the message is sent the sending entity resumes its execution. • In a Sequence Diagram an arrow is usually understood as an operation call on a class. It is therefore synchronous and the calling entity hangs until the operation returns. • It has been said that MSC has been considered as a candidate for the interaction diagrams in UML. • However, proponents of MSC such as Ericsson think that MSC is better than UML 2.0 for modelling large or complex systems.
  • 21. LIVE SEQUENCE CHARTS • David Harel thinks that MSC still has several shortcomings such as: • MSC propose a weak partial ordering semantics that makes it impossible to capture some behavioral requirements, • The relationship between the MSC requirements and the executable specification is not clear. • To address what he sees as weaknesses in the MSC model, David Harel proposed an extension on the MSC standard called LSC (Live Sequence Charts).
  • 22. End