You are on page 1of 11

Statement and Decision Coverage

Considering the following pseudo-code, calculate the MINIMUM number of test cases for statement coverage, and the MINIMUM number of test
cases for decision coverage respectively.

READ A
READ B
READ C
IF C>A THEN
IF C>B THEN
PRINT "C must be smaller than at least one number"
ELSE
PRINT "Proceed to next stage"
ENDIF
ELSE
PRINT "B can be smaller than C"
ENDIF

A. 3, 3.
B. 2, 3.
C. 2, 4.
D. 3, 2.

Given the following code, which is true about the minimum number of test cases

required for full statement and branch coverage

Read P

Read Q

IF P+Q > 100 THEN

Print "Large"

ENDIF

IF P > 50 THEN

Print "P Large"

ENDIF

a) 1 test for statement coverage, 3 for branch coverage

b) 1 test for statement coverage, 2 for branch coverage

c) 1 test for statement coverage, 1 for branch coverage

d) 2 tests for statement coverage, 3 for branch coverage

e) 2 tests for statement coverage, 2 for branch coverage

RE: Given the following code, which is true about the minimum number of test cases required for full statement and branch coverage Read PRead
QIF P+Q > 100 THENPrint "Large"ENDIFIF P > 50 THENPrint "P Large"ENDIFa) 1 test for statement coverage, 3 for branch

option - b) is the correct answer.

1) if p = 51 Q= 50 it will cover all the statements. so one test for statement coverage.

2) for branch coverage:

a) P+Q> 100 AND P>50 (True)


b) P+Q < 100 AND P<50 (False)

a) & b) will cover both the branch conditions


yes it is an ISTQB question.

Given the following code, which is true about the minimum number of test cases required for full statement and branch coverageRead PRead QIF
P+Q > 100 THENPrint "Large"ENDIFIF P > 50 THENPrint "P Large"ENDIFa) 1 test for statement coverage, 3 for branc
Answer: B) 1 test for statement coverage 2 for branch coverage

Code Compliance Testing

I believe Code Compliance Testing means to test whether the code is following the set of coding standards set prior to coding.

What are the tables in test plans and test cases? This concept is related to White box testing in...

we use EXCEL tables

what is merits and demerits of white box and black...

White box and Black box testing both are dynamic testing techniques.
White box testing: testing based on the paths and internal structure and implementation of the software under test. Here we r checking the code
by some coverage processes.
Black box testing: testing based on the behavior and functionality of the software. this is also called as functional testing..
what is merits and demerits of white box and black...

Merits
In Black box testing You test for the functionality of the program components or application against its specification without knowledge of internal
logic.

InWhite box testingpath of logic in unit or component is known it consists of testing paths branch decision condition to produce predictable results.

This technique is usually used during tests


executed by the development team such as Unit or
Component testing

Demerits
In Black box testing u cannot test for hidden functions for eg if in a code there is a fucntion that calcualtes x=a=B/n-1
U cannot test for 'n' in blackbox testing
In White box testing you cannot test for missing funtion for eg : whle doing white box testing u cannot test if the tool tip is shown when a cursor
moves over a button

In white box testing you actually go thru the program logic. But you never know whether a particular user requirement is being met or not or
whether a particular program functionality has been implemented or not.

In black box testing you actually verify the user requirement and
you can identify the missing ones. But if the project is huge you my not be able to provide all code coverage and the logic which
you can do in white box testing.

There is a trade-off between white box and black box testing.

What is merits and demerits of White box and Black...

White box testing Black box testing

1. We will check the coding of the application 1. we will test the functionality of the application

2. Testing done be the developer 2. Testing done by the Testing team


3. Check the coding of single module 3. Check the application for funtionality

4. Other wise know as Gloss boc testing unit testing 4. System testing

5. The modules are not intergrated 5. All the module gets intergrated duning the black box testing

Unit Test Case


Unit Test Case are written by development team or we can say component testers. Unit test cases are important during coding because we can test
our new code with these test cases. Documents required is test cases list what we are executing fot unit test cases.

How to calculate Branch and statement coverage for these?

Switch PC on
Start “outlook”
IF outlook appears THEN
Send an email
Close outlook

a) 1 test for statement coverage, 1 for branch coverage


b) 1 test for statement coverage, 2 for branch coverage
c) 1 test for statement coverage. 3 for branch coverage
d) 2 tests for statement coverage, 2 for branch coverage
e) 2 tests for statement coverage, 3 for branch coverage

IF A > B THEN
C=A–B
ELSE
C=A+B
ENDIF
Read D
IF C = D Then
Print “Error”
ENDIF

a) 1 test for statement coverage, 3 for branch coverage


b) 2 tests for statement coverage, 2 for branch coverage
c) 2 tests for statement coverage. 3 for branch coverage
d) 3 tests for statement coverage, 3 for branch coverage
e) 3 tests for statement coverage, 2 for branch coverage

what are all the tools available for white box testing?

IBM Rational Purify


Pex Automated White box Testing for .NET

What are the tables in testplans and testcases? This concept is related to Whitebox testing in

White box testing is used to test the internal logic of the code.for ex checking whether the path has been executed once checking whether the
branches has been executed atleast oonce .....Used to check the structure of the code

Test plan is a document that contains the scope approach test design and test strategies. It includes the following:-
1. Test case identifier
2. Scope
3.Features to be tested
4. Features not to be tested.
5. Test strategy.
6. Test Approach
7. Test Deliverables
8. Responsibilities.
9 Staffing and Training
10.Risk and Contingencies
11. Approval

While A test case is a noted/documented set of steps/activities that are carried out or executed on the software in order to confirm its
functionality/behavior to certain set of inputs.
What are the tables in testplans and testcases?...

Test plan :-is defined as the techinical approach of testing.


Test plan:- is document which describes scope approach of the efforts made by software testing team.
Testcase:- is a document that describes input action expected response output to know the feature of the software application or the product.
Testcase is only maximum of 3 lines of description that describes your approach with software product or application and it response when you give
someinputs or when you u navigate application.

How do you do path testing?this is related to whitebox testing.This is urgent..anybody tell me please

1.Draw the flowgraph corresponding to the procedural design or code


2.Determine the cyclomatic complexity of the flow graph.
V(G) = E-N+2
where E=No. of edges N=No. of nodes
3.Determine the basis set of independent paths.(The cyclomatic complexity indicates the no. of paths required.)
4.Prepare test cases tha will force execution of each path.
How do you do loop testing?anybody let me know please.

How do you draw flowgraph while working in realtime environment?i,e in a project..in word?or manually on a paper?should it to be shown to test
manager?

Loop Testing
Simple Loops:- The following set of tests should be applied to simple loops where 'n' is the max. no. of allowable passes:
1.Skip the loop entirely.
2.Only one pass thru the loop.
3.Two passes thru the loop.
4.m passes thru the loop where m< n.
5.n-1 n n+1 passes thru the loop.
Nested loops:-
1.Start with the innermost loop.Set all other loop to min. values.
2.Conduct simple loop tests for the innermost loop while holding the outer loops at their min.iteration values.
3.Work outward conducting tests for the next loop but keeping all othe outer loops at their min. iteration count.
4.Continue until all loops have been tested.
Concatenated Loops:-Concatenated loops can be tested using the approach defined for simple loops if the loops are independent.If the loops are
not independent use the nested loop strategy.
Unsructured loops:-Redesign the loops so they are one of the above categories.

Which of the following does not come under technical testing?


a) Volume and performance testing
b) Operational testing
c) Deployment testing
d) Integration testing

Which of the following does not come under technical testing? a) Volume and performance testingb) Operational testingc) Deployment testingd)
Integration testing

Deployment team doesnt come under technical people

Who Says Deployment testing does't come under technical....as there are many technical issues faced by deployment Team. The correct answer is
a) Volume n Performance.

who will do white box testing only developers /testers also ?

White box testing is done by developers mostly. But if tester have the knowledge of the coding lang. in which the product is developing he/she may
also do that.

If tester knows the language then only he can do white box testing.Usually the tester has not the knowledge of the coding language.

White box testing is done by developer only. black box testing is done by tester. His major intention is finding the defects not rectifying the defect.
developer is going to rectifying the defects
white box testing is done by both Developer & tester. But tester should have codingknowledge. White box testing helps testers to find location of
bugs ! when they look insidethe code.Testers find the location of bugs where the bug is & Developer debugs & fixes the bug .finds why the bug has
occured.white box testing helps tester to write test cases remove unnecessary test cases add more required test cases which can cause software t o
crash

Developers only can carryout the whitebox testing. If the tester knows the coding means he/she can also test but testers work is to find the defects
not to rectify so developers only should do the whitebox testing .
Developers alone carryout the whitebox testing. Though the testers know the programming code their work is to find the defects not to solve so the
whitebox testing should be tested by developers.

White Box testing is done by both developers and tester.In case of projects (eg: Railways aeronautics) there are standards (eg CENELAC)to be which
demands testing to be done by a tester in such cases the white box testing is done by tester and not developer. The tester will have a knowledge of
the coding language only then is he called a white box testerThe tester does the white box testing using rational tools like Rational Test Real Time
(RTRT) .

Mostly the white box testing will be done only by the developer. Because the testing is based on coding. It is also called unit testing.

Explain Data Flow Testing? How we will do that? Step by spep procedure?

Data-flow testing looks at the lifecycle of a particular piece of data (i.e. a variable) in an application. By looking for patterns of data usage risky
areas of code can be found and more test cases can be applied.
There are four ways data can be used: defined used in a predicate used in a calculation and killed. Certain patterns using a piece of data in a
calculation after it has been killed show an anomaly in the code and therefore the possibility of a bug.
For more Details and Examples regarding the same go through the site as mentioned below
why WHITE BOX TESTING is also known by the following names?
a) GLASS BOX TESTING
b) CLEAR BOX TESTING
c) OPEN BOX TESTING
d) STRUCTURAL TESTING

2. which of the following testing is least expensive and why?


a) WHITE BOX TESTING
b) VERIFICATION TESTING
c) BLACK BOX TESTING
d) VALADIATION TESTING

White box is also known as clear box because think of something that is white ... ok ... can you "see thru" it? No. Tad-da! Welcome to Clear Box
testing.
1.why WHITE BOX TESTING is also known by the following names?

Let me first tell you one thing...

Until a few years back there is no universal standard for testing definiations or testing procedures....

Now we have some standards as par with testing...

Right now we have two standards for testing..

1. BS7925-2 and ISO.

So before this standarization people used to use different naming conventions to white box testing...

If you clearly look into the works you will get the meaning is standarized.
White Box _ YOu are going to test something like a white box in which you know what is present inside the box...so as the other definiations
also....I hope this gives you some idea...Coming to your second question..

2. which of the following testing is least expensive and why?

See basically testing is of two types...

in which validation and verification.


Verificaiton is process oriented and static.
Validation is product oriented and dynamic.
Obivsoulsy when you like to do dyanaic testing the effort would be high as so cost.
when you just doing verification or static testing the effort need is very low and cost is also low..
Glass Box testing because it is as clear as the glass .In this testing the developer is only in testin the code. i.e testing is done on the code which is
nothing but the structure of the functionality. The glass is so clear that we can see the inner lying part of it. Hence also it is called as Clear Box
testing. The code is open for the developer so it is called as Open Box testing.It is also called as Structural testing because the testing is done on
the coding part of the application.

What are the key ideas for performing WhiteBox Testing?

Use an automated coverage monitor for the analysis of control flow-based unit testing. Compute the cyclomatic complexity to determine the least
number of test cases that should be written. This number does not consider equivalence class partitioning or boundary value analysis – which should
be done for most decision points. Draw the flowgraph for a code segment – at least until you get more used to computing cyclomatic complexity. At
a minimum write enough white box test cases to cover 100 of your statements. Get as high a coverage as possible with your decision/branch and
condition coverage.

What are the levels of testing in which white box testing takes its presence?

There are three levels

1.UnitTesting
2.Integretion Testing
3.Regression testing

Why does a user perform White box testing, when Black box testing is available?

B'coz White Box testing tests the unit of code / program where as Black Box testing has nothing to do with the internal code all it does is based
upon expected output it test the system.

So in any case none of them will be replaced by the other.


Based on the testing requirement respective tests needs to be done.

when u perform white box testing we cheek the internal logic of the code and we know that the code is working properly in black box testing just
we are combing the diffrant modules and cheek that all the modules are integrated properly and valiadate the results

when u perform white box testing we are giveing input data and validating the out put results we know that what exactly the code is doing

In black box testing we valiadte the just output results we donot what is the code is doing

Example for white box testing

Writeing a program and executing the program

Black box means runing the programing some one is written


Though white box method of test design can uncover an overwhelming number of test cases it might not detect unimplemented parts of the
specification or missing requirements. But you can be sure that all paths through the test object are executed
We cant run the whole application with the BVA EP Decision table Error Guessing with Black box Testing techniques. To ensure the test is covered
with Branch statement Path condition with test data to thorughly run. This can be done through by White Box Testing. The tester chooses test case
inputs to exercise paths through the code and determines the appropriate outputs.

What are stubs and drivers used for in white-box testing?

Stubs and Drivers are the small programs used in the integration testing such that these programs are placed where the output of undeveloped
modules. that is in some cases, some of the non priority module's output is needed in the project. then to get out of that situation, we write a
small program such that it generates exactly similar output of the ungenerated module. these programs are called stubs and drivers.

Here stub is used when we are testing the application in top-down approach.
and driver is used when we are testing the application in bottom-top approach.

A driver a software module used to invoke a module

under test and often provide test inputs control and monitor execution and report test
results

drivers in whitebox testing is like for example just calling a method.

for ex. moveMouse(int x int y);


This method will be called by main method.

A stub is a computer program statement substituting for the body of a software module
that is or will be defined elsewhere

For ex.
public void moveMouse(int x int y) {mouse.setPosition(1);
}
developing the stub allows the programmer to call a method in the code being
developed even if the method does not yet have the desired behavior

How should test cases be prepared for Whitebox Testing?

a method for writing a set of white-box test cases that exercise the paths in the code the use of equivalence partitioning and boundary value
analysis to manage the number oftest cases that need to be written and to examine error-prone/extreme corner test cases how to measure how
thoroughly the test cases exercise the code

What is Data flow testing present in whitebox testing?

What are the other names of White box Testing?

glass box testing clear box testing

structual testingClear Box Testing


Glass Box Testing
Transparent Box Testing
Translucent Box Testing or Structural Testing

What knowledge is required by the user to perform Whitebox Testing?

we need to write test cases that ensure the complete coverage of the program logic
for this we need to know the program well i.e. we should know specification and the code to be tested.Knowledge of programming language and
logic

basicly Development and funcnality and Codelogic this immporatant and may the Product or Project knowledge also

What are the key ideas for performing WhiteBox Testing?

Use an automated coverage monitor for the analysis of control flow-based unit testing. Compute the cyclomatic complexity to determine the least
number of test cases that should be written. This number does not consider equivalence class partitioning or boundary value analysis – which should
be done for most decision points. Draw the flowgraph for a code segment – at least until you get more used to computing cyclomatic complexity. At
a minimum write enough white box test cases to cover 100 of your statements. Get as high a coverage as possible with your decision/branch and
condition coverage.

Why is White box testing more expensive than Blackbox testing?

Whitebox Testing requires resources who are familiar with Programming Languages as this type of testing involves in understanding the code and
fixing any bugs if any. This has internal perspective and have to go deep into the code structure to perform the testing.

Whereas Black box testing does not require any knowledge on programming and they do not look at the code as this test can be performed by
anyone or even by a layman without his knowledge though.

I guess this might be the reason behind White box Testing to be expensive

Given specification: if (x>4) then y= x-1; else y= x+1, where x and y are integer variables. List all

Given specification:
if (x>4)
then y= x-1;
else y= x+1,
where x and y are integer variables. List all possible test cases that can detect the bug in the following implementation
if (x >=8) y = x-1;
else y=x+1;
Given specification:

if (x>4)
then y= x-1;
else y= x+1

where x and y are integer variables. List all possible test cases that can detect the bug in the following implementation

if (x >=8) y = x-1;
else y=x+1;

Test with following Data


1] X=0 Then Result Should Be Y=1
2] X=-1 Then Result Should Be Y=0
3] X=2 Then Result Should Be Y=3
4] X=4 Then Result Should Be Y=5
5] X=5 Then Result Should Be Y=4

Test Case Number 5] will be failed while testing

if (x >=8) y = x-1;
else y=x+1;

Here 5 >=8 is false and Result Displayed will be Y=6


Which is wrong.

What is the difference between path coverge and cyclomatic complexity?

Cyclomatic complexity gives the number of independent paths in the program which should be tested.
We can find the cyclomatic complexity by representing the program as flowgraph notation or writing the program in procedural language.

Path coverage is the process of writing and executing the test cases that executes all the independent paths

What is cyclomatic complexity?

The cyclomatic complexity is a software metric that provides a


quantitative measure of the logical complexity of a program.
Cyclomatic complexity is the most widely used member of a class of static software metrics.
Cyclomatic complexity may be considered a broad measure of soundness and confidence for a program. Introduced by Thomas McCabe in 1976 it
measures the number of linearly-independent paths through a program module. This measure provides a single ordinal number that can be
compared to the complexity of other programs. Cyclomatic complexity is often referred to simply as program complexity or as McCabe's
complexity. It is often used in concert with other software metrics. As one of the more widely-accepted software metrics it is intended to be
independent of language and language format.
Cyclomatic complexity has also been extended to encompass the design and structural complexity of a system.
The cyclomatic complexity of a software module is calculated from a connected graph of the module (that shows the topology of control flow
within the program):
It has formula e-n+2
e refers to num of edges
n refers to nodes.
it is matic used to know howmany times the prog has to be excuted to excute all statements.

What is path coverage?. How many path coverage are possible?.

This measure reports whether each of the possible paths in each function have been followed. A path is a unique sequence of branches from the
function entry to the exit.Path coverage has the advantage of requiring very thorough testing. Path coverage has two severe disadvantages. The
first is that the number of paths is exponential to the number of branches. For example, a function containing 10 if-statements has 1024 paths to
test. Adding just one more if-statement doubles the count to 2048. The second disadvantage is that many paths are impossible to exercise due to
relationships of data. For example, consider the following C/C++ code fragment:if (success) statement1;statement2;if (success) statement3;Path
coverage considers this fragment to contain 4 paths. In fact, only two are feasible: success=false and success=true.

this is cyclometric complexity problem for path coverage one wants to find out the number of paths involved in a program. no. of decision+1= path
coverage

A good definition and some examples can be found at http://codign.com/pathbranchcode.html


Path coverage is nothing but the number of paths from start to end of an application.
Possible path coverages can be calculadet by Cyclometic complexity = V- E+2

A path represents the flow of execution from the start of a method to its exit.

The cyclomatic complexity of a software module is calculated from a connected graph of the module (that shows the topology of control flow
within the program):
Cyclomatic complexity (CC) = E - N + p
where E = the number of edges of the graph
N = the number of nodes of the graph
p = the number of connected components
It is a method of LOGIC COVERAGE

And to calculate cyclometric complexity


there are three methods

1)E-N+2

here E - Edges
N - Nodes

2)P+1
here P means Predicate Node i.e Node from which branches are coming out

3)C+1
here C means closed region means when 3 or more than 2 nodes combine and a closed region is formed it is called closed region

1.why WHITE BOX TESTING is also known by the following names? a) GLASS BOX TESTING b) CLEAR BOX TESTING

a) GLASS BOX TESTING


b) CLEAR BOX TESTING
c) OPEN BOX TESTING
d) STRUCTURAL TESTING

2. which of the following testing is least expensive and why?


a) WHITE BOX TESTING
b) VERIFICATION TESTING
c) BLACK BOX TESTING
d) VALADIATION TESTING

Given the following code, which is true about the minimum number of test casesrequired for full statement

Given the following code, which is true about the minimum number of test cases

required for full statement and branch coverage

Read P

Read Q

IF P+Q > 100 THEN

Print "Large"

ENDIF

IF P > 50 THEN

Print "P Large"

ENDIF

a) 1 test for statement coverage, 3 for branch coverage

b) 1 test for statement coverage, 2 for branch coverage


c) 1 test for statement coverage, 1 for branch coverage

d) 2 tests for statement coverage, 3 for branch coverage

e) 2 tests for statement coverage, 2 for branch coverage

Explain Data Flow Testing? How we will do that? Step by spep procedure?Reply

Data-flow testing looks at the lifecycle of a particular piece of data (i.e. a variable) in an application. By looking for patterns of data usage risky
areas of code can be found and more test cases can be applied.
There are four ways data can be used: defined used in a predicate used in a calculation and killed. Certain patterns using a piece of data in a
calculation after it has been killed show an anomaly in the code and therefore the possibility of a bug.
For more Details and Examples regarding the same go through the site as mentioned below
http://openseminar.org/se/modules/166/index/screen.do
Who will do white box testing only developers /testers also ?
White box testing is done by developers mostly. But if tester have the knowledge of the coding lang. in which the product is developing
he/she may also do that.
If tester knows the language then only he can do white box testing.Usually the tester has not the knowledge of the coding language

white box testing only done by developer not the tester because white box testing is static as well as dynamic testing.

White box testing is done by developer only. black box testing is done by tester. His major intention is finding the defects not rectifying
the defect. developer is going to rectifying the defects

white box testing is done by both Developer & tester. But tester should have codingknowledge. White box testing helps testers to find
location of bugs ! when they look insidethe code.Testers find the location of bugs where the bug is & Developer debugs & fixes the
bug .finds why the bug has occured.white box testing helps tester to write test cases remove unnecessary test cases add more required
test cases which can cause software t o crash

White box Testing is testing the internal logic of the program.It is usually done by the developers but if the tester has the knowledge of
the coding language testers are also sometimes involved.

Developers only can carryout the white box testing. If the tester knows the coding means he/she can also test but testers work is to find th defects
not to rectify so developers only should do the whitebox testing .
Developers alone carryout the whitebox testing. Though the testers know the programming code their work is to find the defects not to
solve so the whitebox testing should be tested by developers.
White Box testing is done by both developers and tester.In case of projects (eg: Railways aeronautics) there are standards (eg
CENELAC)to be which demands testing to be done by a tester in such cases the white box testing is done by tester and not developer.
The tester will have a knowledge of the coding language only then is he called a white box testerThe tester does the white box testing
using rational tools like Rational Test Real Time (RTRT)

Mostly the white box testing will be done only by the developer. Because the testing is based on coding. It is also called unit testing.

Control flow loop can be executed () or more times reveal loop defects executes the loop body ?.

How do you do loop testing?anybody let me know ple...

Loop Testing
Simple Loops:- The following set of tests should be applied to simple loops where 'n' is the max. no. of allowable passes:
1.Skip the loop entirely.
2.Only one pass thru the loop.
3.Two passes thru the loop.
4.m passes thru the loop where m< n.
5.n-1 n n+1 passes thru the loop.
Nested loops:-
1.Start with the innermost loop.Set all other loop to min. values.
2.Conduct simple loop tests for the innermost loop while holding the outer loops at their min.iteration values.
3.Work outward conducting tests for the next loop but keeping all othe outer loops at their min. iteration count.
4.Continue until all loops have been tested.
Concatenated Loops:-Concatenated loops can be tested using the approach defined for simple loops if the loops are independent.If the loops are
not independent use the nested loop strategy.
Unsructured loops:-Redesign the loops so they are one of the above categories.

You might also like