You are on page 1of 3

IJCST Vol.

5, Issue Spl - 2, Jan - March 2014 ISSN : 0976-8491 (Online) | ISSN : 2229-4333 (Print)

Smart Techniques of Test Coverage of Object


Oriented Program
1
Aratibala Sahu, 2Bibhuprasad Sahu, 3Prasant Kumar, 4Rajesh Kumar Subudhi
1
Berhampur University, India
2,3,4
Gandhi Institute for Technology, Bhubneswar, Odisha, India

Abstract idea is to have the specifications, rather than the implementation,


The benefit of coverage analysis is a structural testing technique drive the testing strategy. This is the V process model applied to
that helps to eliminate the space or gap in a test suite and find software engineering.
out the position to stop the testing. This is a implementation of To reach full coverage, statement and decision coverage used.
new techniques to coverage about the variables with program The statement measures which source code is exercised and the
slicing. Providing the power according to their importance, so decision coverage measures how the Boolean expressions are
that the user can focus on the importance variables to generate the evaluated. Reaching certain a certain degree of coverage means
highest test coverage. The present available method to compute that the requirement driven testing strategy involves a set of tests
the basic coverage based on the program structure matrix. This whose execution exercise all structures the metric targets.
paper report is bigger than that obtained by the old measure,
because the coverage about a variable takes only the related code IV. Overall Model Based Testing Process (Purposed
into the account. Approach)

Keywords
We would like to encourage you to list 4 to 5 keywords in this
section.

I. Introduction
Test coverage is a measure used in software testing. It describes the
degree to which the source code of a program has been tested. This
form of testing that inspects the code directly and therefore a form
of white box testing. Use of code coverage has been extended to the
concept of digital hardware, the contemporary design methodology
of which relies on hardware description languages (HDLs).
Coverage scanner is a c++ program, preprocess the source code Fig. 1:
using the native preprocessor program, insert instrumentation code
and finally compilers the project file. Coverage scanner analyses This above fig. states the artifacts and activities of the model based
the sequential statements to record each execution path. To avoid testing process in the purposed approach. The activities involved
the performance problem coverage scanner groups all sequential are described below.
instruction instructions together and records their execution only
once before execution of the last sequential instruction, this kind A. Visual Modeling
coverage instrumentation is called statement coverage. Code The structure and behavior of the relevant features of the SUT are
coverage monitors execution by recording if the condition was modeled and UML activity and class diagram, using an existing
true or false during complete application execution. This type of UML tool.
code coverage instrumentation is called Decision Coverage.
B. Test Case Generation
II. Componentes of Objects Oriented Systems in the In the AMBER test environment, the visual UML model is
Contexts of test Coverge first translated into as formal Spec# model.Abstrat test cases
To understand the applicability of conventional testing methods are subsequently generated automatically with Spec Explorer
to object oriented programming, it is needed to examine the by bounded exploration of Spec# model, based on parameters
components of these five components such as supplied by tester. These parameters should choose carefully.
• Objects
• Their associated messages and methods C. Test Coverage Analysis
• Classes of objects New MoCAT tool helps assessing the adequacy of the test suite
• External interface generated in the above step. It receives the UML model and the
• Tools and utilities abstract test suite produced by Spec Explorer and produces a
colored UML model showing the elements covered.
III. Covertures: An Innovative Open Framework For Cove
Rage Analysis of Safety Critical Applications D. Test Case Concretization and Execution
The development of high intensity application usually requires The abstract test cases generated from the model have to
a close interaction between the design and testing phase. System transform into concrete test case. Concrete test cases are executed
requirements are decomposed into high level architecture, then automatically on the SUT and all inconsistencies found should
into modules and use some language such as Ada and C/C++. report.
The test cases are derived from the requirements themselves, the

66 International Journal of Computer Science And Technology w w w. i j c s t. c o m


ISSN : 0976-8491 (Online) | ISSN : 2229-4333 (Print) IJCST Vol. 5, Issue Spl - 2, Jan - March 2014

V. Input to the Coverage Analysis Algorithms


The inputs for the coverage analysis algorithms are the UML • Operator Coverage
model and the test suite. • Operand Coverage
The UMLmodel must contain a root activity diagram that is the
starting point for the coverage analysis. This diagram may contain IX. Different Types of Coverage
composite activities and actions that call behaviors described in
the additional diagrams. And the UML diagram contains class A. Static & Dynamic Analysis
diagram. Static analysis involves going through the code in order to find
out any possible defect in the code. Dynamic analysis involves
VI. Important Testing Techniques execution the code and analyzing the output.
As we all know there are different testing can implemented such Statement Coverage is a code coverage metric that tells whether
as the flow of control reached every executable statement of source
code.
A. Unit Testing
1. Black Box Testing Simple if statement Example:
2. White Box Testing Code:
In some situations, for the applications which require a very high Int*p;
quality, requesting that a portion of the code is executed is not If(condition){
enough. Two solutions are there such as P=&variable;
• Code Coverage Count *p=1;
• Test Coverage Count }
*p=0;
VII. Two Broad Classes of Coverage Mesures If condition ever evaluate false, this code dereference a null
Coverage is measured by incrementing a program to determine pointer.
how thoroughly a test suite exercises it.
1. Path based Coverage Logical Operator Example:
2. Fault based Coverage Code:
The path based coverage requires the execution of particular Void function (const char* string1, const char* string2=null)
components of the program, such as statements, branches or …
complete paths. A path represents the flow of the execution from Void function (const char* string1, const char* string2)
the start of a method to its exit. {
Example: If (condition||strcmp (strcmp (string1, string2) ==0)
Package path X; ….
Public class path }
{ Statement Coverage declares this code fragment fully covered
Public int return input (int x, Boolean condtion1, Boolean condition when condition is true. When false the call to strcmp gets a invalid
2, Boolean condition 3) argument, a null pointer.
{
If (condtion1) {x++ ;} Loop termination Decision Example:
If (condtion1) {x-- ;} Code:
If (condtion1) {x++ ;} Char output [50];
Return x ;}} For (int i=0;i<=size of (output);i++)
Output[i] =input[i];
The faults based coverage requires that the test suite exercise the If (input[i] ==”\0”
program in a way that would reveal likely faults. [
To define four linearly independent paths as a base line those are Break;
TTT, FTT, TFT, TTF. Where TFT and FTT FOUND the bugs that }
was missed by our statements and branch efforts .So we had started }
with FFF as our base line path, then you would wind of the basis The main loop terminates decision<= size of output, intend to
set of (FFF,TFF,FTF,FFT) making TTT path extraneous. prevent overflowing to the output buffer. The overflow decision
correctly indicates to use < rather than operator<=.
VIII. Fault Based Coverage
This is also known as Weak mutation coverage. If a program B. Decision Coverage
consist of simple kind of fault like instead of < if we use <=.In Decision coverage combines the requirement for decision coverage
the program a weak mutation coverage system will produce a with those for condition coverage.
message like “gcc.c”, operator <= might be <, this message would Decision Coverage= (no of decision outcomes executed /total no
be produced still the program was executed over a test case such of decision outcomes)*100%
that (A XOR B) has a different value than (A<B) Example:
So we must satisfy a coverage condition (A XOR B) U (A<B) or READ X;
equivalently .that A XOR B. READ Y;
90% of such fault will be detected by weak mutation coverage. IF”X>Y”
There are two types of weak coverage. PRINT X is greater than y

w w w. i j c s t. c o m International Journal of Computer Science And Technology   67


IJCST Vol. 5, Issue Spl - 2, Jan - March 2014 ISSN : 0976-8491 (Online) | ISSN : 2229-4333 (Print)

END [7] L.Apfelbaum, J.Doyle,"Model Based Testing”, In software


IF Quality week Conference, 1997
In order to get 100% statement coverage only one test case is [8] [Online] Available: http://www.softiwaretestingmentor.
sufficient for this pseucode com
TESTCASE1:X=10Y=5 [9] [Online] Available: http://www.testinggeek.com
[10] test Coverage analysis of UMLActiivity diagram for interactive
C. Condition Coverage systems", 2010 Seventh International conference on the
Condition Coverage is also known as Predicate coverage. quality of information and Communication Technology.
Condition coverage is seen for Boolean Expression, condition [11] Testing of object oriented programming System(OOPS):A
coverage whether all Boolean expression have been evaluated to Fault-Based approach.Jane Huffman Hayes.Science
both TRUE and FALSE. Applications Internationa Corporation,1213 jeffersion-Devis
Highway,suite 1300,Arlington,Virginia22202.
D. Decision Coverage
The decision coverage criterion by requiring that each condition Aratibala Sahu(M.tech), Research
be shown to independently affect the outcome of the decision. The Scholar, Berhampur university, India.
independence requirement ensures that effect of each condition
is tested relative to other conditions.
Multiple Condition Coverage:
Multiple Condition Coverage is also known s condition
Combination Coverage.
Example:
If (A||B)
Then
Print C
Now it is having two Boolean expressions A and B.Then the
multiple Condition coverage will be Bibhuprasad Sahu received his M.Tech
TESTCASE1: A=TRUE, B=TRUE degree in Computer science from NIST,
TESTCASE2: A=TRUE, B=FALSE Berhampur, Odisha, India in 2011-
TESTCASE3: A=FALSE, B=TRUE 12. At present, He is working as Asst
TESTCASE4: A=FALSE, B=FALSE Prof. in Department of CSE at GIFT,
It has been clear that if there are n cases then 2n Odisha, India. He is having 5 years
Conditions. of experience in teaching line. His
Ten code coverage tools for C&C++ research interests include wireless sensor
Code coverage is measure used in software testing that describes network, Computer Network., Software
the degree to which the source code of program has been tested. Engineering, Software Testing and Digital
There are different types of tools such as follows Image Processing.
Test well CTC++, Coverage meter, Bullseye coverage,
GCT, CppUnit, Dynamic code Coverage, TCATC/C++, and
COVTOOL. Prasant Kumar Behera, He is working as
Asst Prof. in Department of CSE at GIFT,
X. Conclusion Odisha, India. He is having 5 years of
Design feature that contribute the most to test coverage are experience in teaching line. His research
• No recompilation of the source program. interests include wireless sensor network,
• No special hardware is needed Computer Network.
So hope this test coverage testing method is useful for to reduce
stress on programmer and increase the reliability.

Reference
[1] Sreenivasa S.Pisupati,"Planetsoft”, Test coverage analysis
process”. Rajesh Kumar Subudhi received his
[2] Mustafa M.Tikir,"Efficient online computation of statement M.Tech degree in Computer Sc. And
coverage”. Informatics from ITER, Bhubaneswar,
[3] Coverage meter,"Code Coverage measurement for C/ Odisha, India, in 2013. He is engaged
C++". in Department CSE , Gandhi Institute
[4] Bernhard rumpe,"Model based testing of object object For Technology, Bhubaneswar, Odisha,
oriented systems”. India. His research interests include
[5] DanialGraziotin, Element and Concepts,"Introduction to digital Image processing, Software
software testing”. Engineering and Soft Computing.
[6] D.Seifert, C.Gaston,"Evaluating coverage based testing",
Vol-3472/2005, 2005: Spinger Berlin/Heidelberg, pp. 293-
322.

68 International Journal of Computer Science And Technology w w w. i j c s t. c o m

You might also like