KEMBAR78
Slice Based testing and Object Oriented Testing | PPTX
Slice based testing &
Object Oriented Testing
Varsha Sharma • 18010001030
Slice Based Testing
What’s Slice??
A program slice is a
subset of that program.
Varsha Sharma
Origin Story of Slicing Techniques . . ! !
● The Original definition was
given by Mark Weiser,
● slicing was only static that time.
● Bogdan Korel and Janusz Laski
introduced dynamic slicing.
Varsha Sharma
Also known as Program Slicing Technique...
● In this we takes a slice of the program for testing particular test
conditions or cases and that may affect a value at a particular point of
interest.
Useful
in
Debugging
Testing
Software
Quality
Assurance
Software
Maintenance
Filtering out
“Irrelevant
Code”.
Varsha Sharma
How it Works??
Breaking your code into smaller pieces.
Varsha Sharma
Static
Slicing Dynamic
Slicing
Types of Slicing
Varsha Sharma
Static Slicing
1. Set of all statements that may affect the
value of a variable at a program point.
2. Uses static information i.e. a source
program.
3. Regression Testing.
Varsha Sharma
Static Slicing
For variable sum.
int z = 10;
int n;
cin >> n;
int sum = 0;
if (n > 10)
sum = sum + n;
else
sum = sum - n;
cout << "Hey";
Let’s see an Example:
Static Slice of the Program
Varsha Sharma
1. Set of all statements that actually affect the
value of a variable at a program point.
2. Uses dynamic information i.e. an execution
trace.
3. Debugging.
Dynamic Slicing
Varsha Sharma
For variable sum when n=22.
int z = 10;
int n;
cin >> n;
int sum = 0;
if (n > 10)
sum = sum + n;
else
sum = sum - n;
cout << "Hey";
Let’s see an Example:
Dynamic Slice of the Program
Dynamic Slicing
Varsha Sharma
int z = 10;
int n;
cin >> n;
int sum = 0;
if (n > 10)
sum = sum + n;
else
sum = sum - n;
cout << "Hey";
int n;
cin >> n;
int sum = 0;
if (n > 10)
sum = sum + n;
int n;
cin >> n;
int sum = 0;
if (n > 10)
sum = sum + n;
else
sum = sum - n;
Static Slicing VS Dynamic Slicing
Varsha Sharma
Object Oriented Testing
As information systems are becoming more complex, the object-oriented paradigm
is gaining popularity because of its benefits in analysis, design, and coding.
Varsha Sharma
Varsha Sharma
Levels/Techniques of Object Oriented Testing :
Class Testing/ Unit
Testing
• Every individual
classes are tested
for errors or bugs.
Interclass Testing/
Integration testing/
Sub-system testing.
• Modules or sub-
systems are
tested and their
coordination with
other modules.
System Testing
• Whole System is
Tested.
Varsha Sharma
Class Testing Process
class
to be
tested
test cases
results
software
engineer
How to test?
Varsha Sharma
Developing Test Cases
Points to be noticed :
i. Identify each test case uniquely
ii. State the purpose of the test
iii. All the states of object that is to be tested should be
specified.
iv. External Conditions should be mentioned
v. Automated unit testing tools facilitate these requirements
Varsha Sharma
Issues in Object
Oriented Testing ??
1. Additional testing techniques are
required to test additional
Dependencies in Object Oriented
System.
2. it is not possible to test the class
dynamically
3. the concept of inheritance &
polymorphism opens various issues
4. Encapsulation in class may create
obstacles while testing.
5. State of object is difficult to acquire.
Varsha Sharma
Thank You…
Varsha Sharma

Slice Based testing and Object Oriented Testing

  • 1.
    Slice based testing& Object Oriented Testing Varsha Sharma • 18010001030
  • 2.
    Slice Based Testing What’sSlice?? A program slice is a subset of that program. Varsha Sharma
  • 3.
    Origin Story ofSlicing Techniques . . ! ! ● The Original definition was given by Mark Weiser, ● slicing was only static that time. ● Bogdan Korel and Janusz Laski introduced dynamic slicing. Varsha Sharma
  • 4.
    Also known asProgram Slicing Technique... ● In this we takes a slice of the program for testing particular test conditions or cases and that may affect a value at a particular point of interest. Useful in Debugging Testing Software Quality Assurance Software Maintenance Filtering out “Irrelevant Code”. Varsha Sharma
  • 5.
    How it Works?? Breakingyour code into smaller pieces. Varsha Sharma
  • 6.
  • 7.
    Static Slicing 1. Setof all statements that may affect the value of a variable at a program point. 2. Uses static information i.e. a source program. 3. Regression Testing. Varsha Sharma
  • 8.
    Static Slicing For variablesum. int z = 10; int n; cin >> n; int sum = 0; if (n > 10) sum = sum + n; else sum = sum - n; cout << "Hey"; Let’s see an Example: Static Slice of the Program Varsha Sharma
  • 9.
    1. Set ofall statements that actually affect the value of a variable at a program point. 2. Uses dynamic information i.e. an execution trace. 3. Debugging. Dynamic Slicing Varsha Sharma
  • 10.
    For variable sumwhen n=22. int z = 10; int n; cin >> n; int sum = 0; if (n > 10) sum = sum + n; else sum = sum - n; cout << "Hey"; Let’s see an Example: Dynamic Slice of the Program Dynamic Slicing Varsha Sharma
  • 11.
    int z =10; int n; cin >> n; int sum = 0; if (n > 10) sum = sum + n; else sum = sum - n; cout << "Hey"; int n; cin >> n; int sum = 0; if (n > 10) sum = sum + n; int n; cin >> n; int sum = 0; if (n > 10) sum = sum + n; else sum = sum - n; Static Slicing VS Dynamic Slicing Varsha Sharma
  • 12.
    Object Oriented Testing Asinformation systems are becoming more complex, the object-oriented paradigm is gaining popularity because of its benefits in analysis, design, and coding. Varsha Sharma
  • 13.
  • 14.
    Levels/Techniques of ObjectOriented Testing : Class Testing/ Unit Testing • Every individual classes are tested for errors or bugs. Interclass Testing/ Integration testing/ Sub-system testing. • Modules or sub- systems are tested and their coordination with other modules. System Testing • Whole System is Tested. Varsha Sharma
  • 15.
    Class Testing Process class tobe tested test cases results software engineer How to test? Varsha Sharma
  • 16.
    Developing Test Cases Pointsto be noticed : i. Identify each test case uniquely ii. State the purpose of the test iii. All the states of object that is to be tested should be specified. iv. External Conditions should be mentioned v. Automated unit testing tools facilitate these requirements Varsha Sharma
  • 17.
    Issues in Object OrientedTesting ?? 1. Additional testing techniques are required to test additional Dependencies in Object Oriented System. 2. it is not possible to test the class dynamically 3. the concept of inheritance & polymorphism opens various issues 4. Encapsulation in class may create obstacles while testing. 5. State of object is difficult to acquire. Varsha Sharma
  • 18.

Editor's Notes

  • #2 Where are these notes visible??
  • #5 Program slices are more manageable for testing and debugging rather than taking up whole code. • During testing, debugging, or understanding a program, most of the code in the program is irrelevant to what you are interested in. • Program slicing provides a convenient way of filtering out “irrelevant” code.
  • #6 Slicing criterion may include: Slicing variable: Slicing variable may be based on the variables specified in the criteria (slicing point of interest) or it may be on all variables. Type of the result: The result of slicing may be equivalent to the program of few set of statements from the program. Slicing Point: Considering the Slicing point, programmer interest may be before or after a particular statement [4]. Scope: The scope of the slice may be interprocedural or it may be intraprocedural [30]. Slicing Direction: The expected slice from the program may be in the forward or backward direction. Type of Information: The information that we obtain from the slice will be either a static or it may be a dynamic one. Output format: The format that can be obtained after slicing may seem to be in the form of code which is equivalent to source code or it may be a dependence graph or may be in the form of execution tree.
  • #8 A static slice of a program contains all statements that may affect the value of a variable at any point for any arbitrary execution of the program. Static slices are generally larger. It considers every possible execution of the program.
  • #10 A dynamic slice of a program contains all the statements that actually affect the value of a variable at any point for a particular execution of the program. Dynamic slices are generally smaller. Considers only a particular execution of the program.
  • #12 static slice takes all the possible execution (in this case it is 2) of the program which may affect the value of the variable sum. Whereas in case of dynamic slicing, it considers only a particular execution (when n = 22) of the program which may affect the value of the variable sum.
  • #13 Whenever large scale systems are designed, object oriented testing is done rather than the conventional testing as the concepts of object oriented programming is way easy than conventional ones.  this testing revolves around the fundamental entity known as “class”.  With this ,the larger systems are divided into small units which may then be implemented separately.
  • #14 We are aware of OOP that it is a particular way of programming that leverage the concept of Classes and Objects and the 4 paradigms of Object Oriented Programming that are Abstraction: a process where you show only “relevant” data and “hide” unnecessary details of an object from the user. Encapsulation: a practice that bind the data with the code that manipulates it and keeps the data and the code safe from external interference Inheritance: the mechanism by which an object acquires the some (or all) properties of another object. Polymorphism: a way to process objects differently based on their data type. In other words objects can have the same name for a method but the implementation may differ.
  • #15 Class testing ensures that the attributes of class are implemented as per the design and specifications. Also, it checks whether the interfaces and methods are error free of not. - System testing: the system is tested as whole and primarily functional testing techniques are used to test the system. Non- functional requirements like performance, reliability, usability and test-ability are also tested.
  • #17 Identify each test case uniquely - Associate test case explicitly with the class and/or method to be tested State the purpose of the test Each test case should contain: A list of messages and operations that will be exercised as a consequence of the test A list of exceptions that may occur as the object is tested A list of external conditions for setup (i.e., changes in the environment external to the software that must exist in order to properly conduct the test) Supplementary information that will aid in understanding or implementing the test Automated unit testing tools facilitate these requirements
  • #18 the dependencies occurring in conventional systems are: Data dependencies between variables Calling dependencies between modules Functional dependencies between a module and the variable it computes Definitional dependencies between a variable and its types. But in Object-Oriented systems there are following additional dependencies: Class to class dependencies Class to method dependencies Class to message dependencies Class to variable dependencies Method to variable dependencies Method to message dependencies Method to method dependencies 2. it is not possible to test the class dynamically, only its instances i.e, objects can be tested. 3. the concept of inheritance opens various issues e.g., if changes are made to a parent class or superclass, in a larger system of a class it will be difficult to test subclasses individually and isolate the error to one class. Test cases designed for base class are not applicable to derived class. 4. Encapsulation of attributes and methods in class may create obstacles while testing. As methods are invoked through the object of corresponding class, testing cannot be accomplished without object. 5. In addition, the state of object at the time of invocation of method affects its behavior. Hence, testing depends not only on the object but on the state of object also, which is very difficult to acquire.