St Lab Manual
Short Description
Download St Lab Manual...
Description
1
S.No
1
2
3
LIST OF EXPERIMENTS Consider an automated banking application. The user can dial the bank from a personal computer, provide a sixdigit Password and follow with a series of keyword commands that activate the banking function. The software for the application accepts data in the following form: Area Code Blank or three-digit number Prefix Three-digit number, not beginning with 0 or 1 Suffix Four-digit number Password Six-character alphanumeric Commands "Check status", "Deposit", "Withdrawal" Design adhoc test cases to test the system Design the test cases to test the above application using the following Black Box testing techniques: BVA, Worst BVA, Robust BVA, Robust Worst BVA, Equivalence class testing
Page No
4
11
Consider an application that is required to validate a number according to the following simple rules: 1. A number can start with an optional sign. 2. The optional sign can be followed by any number of digits. 3. The digits can be optionally followed by a decimal point, represented by a period. 4. If there is a decimal point, then there should be two digits after the decimal. 5. Any number-whether or not it has a decimal point, should be terminated a blank. 6. A number can start with an optional sign. 7. The optional sign can be followed by any number of digits. 8. The digits can be optionally followed by a decimal point, represented by a period. 9. If there is a decimal point, then there should be two digits after the decimal. 10. Any number-whether or not it has a decimal point, should be terminated a blank. Generate test cases to test valid and invalid numbers. Generate test cases using Black box testing technique to Calculate Standard Deduction on Taxable Income. The standard deduction is higher for tax payers who are 65 or older or blind. Use the method given below to calculate tax.
24
1. The first factor that determines the standard deduction is the filing status. The basic standard deduction for the various filing status are: 4
5
6
7
Single $4,750 Married, filing a joint return $9,500 Married, filing a separate return $7,000 2. If a married couple is filing separate returns and one spouse is not taking standard Deduction, the other spouse also is not eligible for standard deduction. 3. An additional $1,000 is allowed as standard deduction, if either the filer is 65 yrs or the spouse is 65 yrs or older 4. An additional $1,000 is allowed as standard deduction, if either the filer is blind or the spouse is blind. Consider A program segment which calculates the maximum value among three integers. a) Draw the control flow graph for this program segment b) Determine the cyclomatic complexity for this program c) Determine the independent paths. For a Source code of simple insertion sort implementation using array in ascending order in c programming language, a) Draw the program graph for given program segment b) Determine the DD path graph c) Determine the independent paths d) Generate the test cases for each independent path Consider a system having an FSM for a stack having the following states and transitions: States • Initial: Before creation • Empty: Number of elements = 0 • Holding: Number of elements > 0, but less than the maximum capacity • Full: Number elements = maximum • Final: After destruction
III Year II Sem
Software Testing Lab
30
36
41
WISE
2
• • • •
8
9
10
11
12
Initial to Empty: Create Empty to Holding, Empty to Full, Holding to Holding, Holding to Full: Add Empty to Final, Full to Final, Holding to Final: Destroy Holding to Empty, Full to Holding, Full to Empty: Delete Design test cases for this FSM using state table-based testing.
For a given fragment of program code, calculate the number of tests required for 100% decision coverage? Also write the test cases.
44
Given the following code, how much minimum number of test cases is required for full statement and branch coverage?
48
read p read q if p+q> 100 then print "Large" endif if p > 50 then print "p Large" endif Consider a program to input two numbers and print them in ascending order given below. Find all du paths and Identify those du-paths that are not feasible. Also find all dc paths and generate the test cases for all paths (dc paths and non dc paths).
55
Consider the above program and generate possible program slices for all variables. Design at least one test case from every slice.
57
Consider the code to arrange the numbers in ascending order. Generate the test cases for relational coverage, loop coverage and path testing. Check the adequacy of the test cases through mutation testing and also compute the mutation score
60
for each. i = 0; n=4; //N-Number of nodes present in the graph While (ik) max=j 8. else max=k 9. return(max); 10. } a. Draw the control flow graph for this program segment b. Determine the cyclomatic complexity for this program c. Determine the independent path. AIM: To draw the control flow graph to calculate the cyclomatic complexity and independent path for given problem.
III Year II Sem
Software Testing Lab
WISE
32
DESCRIPTION: sequence
selection
iteration
1. x=5
1. if x0)
3. else x=x*y;
3. x=x+5
4. printf("%d",x);
count=count-1
a1
4. printf("%d",x); 1
2
3
2
1
4 2
3
4
Control flow graph: A control flow graph represents the execution path with in a program code. It covers selective, iterative, sequence statements in a given code.
III Year II Sem
Software Testing Lab
WISE
33
III Year II Sem
Software Testing Lab
WISE
34
Cyclomatic complexity: It is a metric used for measuring the complexity of a given program code with respect to dependent and independent paths in a control flow graph (coupling and cohesion). It can be calculate in three ways: 1. The total number of predictive node is equal to the cyclomatic complexity of the program. 2. The total number of independent paths equal the cyclomatic complexity. 3. By calculating the total number of nodes and edges in the control flow graph using formula: no. of edges-no. of nodes+2(E-N+2) Independent path: Independent path through the program it introduces at least one new edge that is not included in any other path before it. p1:1->2->3->8->9 p2:1->2->3->4->5->6->7->9 p3:1->2->3->4->5->6->5->9
Program: a. control flow graph 1
III Year II Sem
Software Testing Lab
WISE
35
2
3 4 5
7
6
9
8
10 b. cyclomatic complexity: Here, N=10 and E=12 E-N+2 =12-10+2 =2+2 =4 c. independent paths: path1:1->2->3->4->5->9 path2:1->2->3->4->5->6->9 path3:1->2->3->4->7->8->9 path4:1->2->3->4->5->7->8->9
III Year II Sem
Software Testing Lab
WISE
36
Viva Questions: 1) What is cyclomatic complexity? 2) What is an independent path? 3) What is control flow graph? 4) What are the loops? 5) Difference between the independent path and dependenth path.
III Year II Sem
Software Testing Lab
WISE
37
Exp No-6:Aim: Source code of simple insertion sort implementation using array in ascending order in c programming language. Description: #include int main () { int i, j, s, temp, a [20]; Printf (“enter total elements :”); Scanf (“%d”, &s); Printf (“enter %d elements:” s); for (i=0; i=1. c) Determine the independent paths. 1
2
3
4
5
6
18
Cyclometric Complexity E=24, n=25 24-25+2=-1+2=1
d) Generate the test cases for each, independent path.
7
8
For (i=0; j width then Biggest_dimension=height End-if Else if biggest_dimension=length then If height > width Then biggest_dimension=height End-if End-if End-if Code segment: If(width>length) { Biggest_dimension=width; If(height>width) { Biggest_dimension=height; } }
III Year II Sem
Software Testing Lab
WISE
47
Else if (dimension=length) { If(height>length) Biggest_dimension=height } } Aim:to generate the test cases for 100% decision coverage Description: to every decision condition should be in test cases is called 100% decision coverage. Condition:
width > height
Assume width=10 height=3 length=6 Testcase1: input 10>6
output true
Analysis: test case succeeded Condition:
biggest_dimension=width=10 height > width
testcase1: input 3>10
Output False
Analysis: test case succeeded Width=10 Height=15 Length=6 Condition:
width > length
Testcase1:
III Year II Sem
Software Testing Lab
WISE
48
input 10>6
output true
Analysis: test case succeeded biggest_dimension=width=10 Condition:
height>width
Testcase1: input 15>10
output true
Analysis: test case succeeded biggest_dimension=height=15 Condition:
width>length
Testcase1: input 10>6
output true
Analysis: test case succeeded biggest_dimension=width=10 Testcase1: input 15>16
output true
input 10>11
output true
Analysis: test case is failed Condition:
width>length
Testcase1:
III Year II Sem
Software Testing Lab
WISE
49
Analysis: test case is failed Dimension=length Testcase1: input 6=6
output true
Analysis: test case is succeeded Height>length Testcase1: input 15>6
output true
Analysis: test case is succeeded Flowchart:
Width>height
true
Width>length
false
Dimension=lengt h
false true fals
III Year II Sem
Biggest_dimension= height
Height>length
Software Testing Lab
false
WISE
50
Exp No-9:Aim: Give the following code,how much minimum number of test cases required for full statement and branch Out of coverage. loop
Read pread 2
Biggest_dimension=h eight
If p+q>100
Out of loop
Then print “large” End if If p>50 Then print “plarge” #include { Int p,q; Printf(“enter p:”); Scanf(“%d”,&p); Printf(“enter q:”); Scanf(“%d”,&q); If(p+q>100) { Printf(“large”); } Else { Printf(“small”);
III Year II Sem
Software Testing Lab
WISE
51
} If(p>50) { Printf(“plarge”); Else { Printf(“psmall”); } } Description: The statement coverage also known as line coverage or segment coverage.The statement coverage along the true conditions.Through statement coverage we can identify the statements executed and where the code is not executed because of blockage.In this process each and every line of code needs to be closed and executed. Branch testing: It is a testing method which aims to ensure that each one of the possible branch from each decision point executed atleast once and there by ensuring that all reachable code executed. That is every branch taken each lay true and false.it helps in validating all the branches in the code making sure that no branch leads to abnormal behavior of the application.
III Year II Sem
Software Testing Lab
WISE
52
Control flow graph: 1
Read p,q p
2 Print p+q large
3
4
5 P is large 6
7
8
9
13 13
10
14 14 15
11 1
16 16 18 18
22 22
24 III Year II Sem 24
Software Testing Lab
WISE
53
Test-cases: Condition:#include(header file) Test case:1 Input
Expected outcome
#include
false
Analysis: Test case failed Test case:2 Input
Expected outcome
#include
Accepted
Analysis: Test case failed Test case:3 Input Expected outcome #include Accepted Analysis: Test case excuted successfully Condition: Int p; Test case:1 Input Expected outcome Int p; Accepted Analysis: Test case excuted successfully Test case:2 Input Expected outcome Float p; Accepted Analysis: Test case rejected Test case:3 Input
III Year II Sem
Expected outcome
Software Testing Lab
WISE
54
Float p; Rejected Analysis: Test case executed successfully Condition: Int q; Test case:1 Input Expected outcome Int q; Accepted Analysis: Test case executed successfully Test case:2 Input Expected outcome Char q; Rejected Analysis: Test case executed successfully Condition: P+q>100; Test case:1 Input Expected outcome P+q>100 Accepted Analysis: Test case executed successfully Test case:2 Input Expected outcome P+q=100 Rejected Analysis: Test case executed successfully
III Year II Sem
Software Testing Lab
WISE
55
Test case:3 Input P+q50 Accepted Analysis: Test case executed successfully Test case:2 Input p>50
Expected outcome Rejected
Analysis: Test case failed Test case:3 Input Expected outcome P=50 Rejected Analysis: Test case executed successfully Test case:4 Input
Expected outcome
p
View more...
Comments