Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Implementation of halstead
1. IMPLEMENTATION OF HALSTEAD’S METRICS
AIM:
To measure the given software implementation using Halstead’s metrics and test it by
path testing method.
PROCEDURE:
TEST PLANNING:
1. Test strategy
Scope of testing
To test the path of implementation using Halstead’s metrics.
Test deliverables
To test the measurements of the given program using C language.
• Calculate vocabulary and length using
Vocabulary=n1+n2
Length=N1+N2
N1=n1log (n1)
• Calculate Volume
V=Nlog(n)
• Calculate Level ,Effort and Fault
L=V*/V
E=V/L
Tools used win runner & C programming.
2. Test plan
It is a document to say what to test, when to test, how to test, who to test.
• What to test- to find the Volume ,Effort and Fault
using C program.
• How to test-by using Win Runner.
• who to test- Developer.
• When to test-after executing C program.
3. Test bed- Win Runner and C programming language.
TEST DEVELOPMENT:
Test cases
i. volume
2. ii. effort
iii. no of distinct operator
iv. no of distinct operands
v. total no of operator
vi. total no of operands
TEST EXECUTION:
Step 1: Start the program
Step 2: Input a and b
Step 3: addition of a and b is printed
Step 4: Assign n1,n2,N1,N2 to no of operators and operands
n1No of distinct operators in a program
n2No of distinct operands in a program
n1No of operator occurrences
n2No of operand occurrences
Step 5: Calculate vocabulary and length using
Vocabulary=n1+n2
Length=N1+N2
N1=n1log (n1)
Step 6:
V=Nlog (n)
Step 7: Calculate level and Effort and Fault
L=v*/v
E=v/L
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
float a,b,c,N,N1,N2,n,n1,n2,D,V,E;
clrscr();
printf("addtion of two numn");
printf("enter a and b value n");
scanf("%f %f",&a,&b);
3. c= a+b;
printf("the result is %fn",c);
n1=3;
n2=11;
N1=8;
N2=19;
N=N1+N2;
n=n1+n2;
V=N*log(n);
D=n1/2*n2/2;
E=D*V;
printf("program length n %f",N);
printf("program vocabularyn %f",n);
printf("volumen %f",V);
printf("difficulty n %f",D);
printf("effortn %f",E);
getch();
}
TEST REPORTING:
4. Addition of two numbers
Enter the a and b
32
5
Program length 27.0000
Program vocabulary 14.0000
Volume -882360.0000
Effort 8.250000
Difficulty-7279470
TEST RESULT ANALYSIS:
Step1: Initialize the win runner
Start programs win runner win runner
Step2: Create a new html document to be tested and save it on the desktop
Step3: In win runner create a new task
Step4: Click on record button and open the saved html file
Step5: Then click on stop button the file will be recorded automatically
Step6: Then click on the button Run from top,
This will automatically give the test result as
Pass: If executed with out errors
Fail: If executed with some errors
And the execution time will also be displayed
Step7: Then go to Tools GUI Map Editor
And save the file at some location say for example “desktop”.
5. RESULT:
Once the test meets the exit criteria the activities such as capturing the key output
lessons learned result,logs,documents related to the project are achieved and used as
reference for next project .