ST Lab - Merged
ST Lab - Merged
NAINI, PRAYAGRAJ
(Affiliated to Dr. A.P.J Abdul Kalam Technical University, Lucknow)
7th SEMESTER
NAME:
…………………………………………………………
ROLL NO:
…………………………………………………………
BRANCH/SEM/SEC:
…………………………………………………………
INDEX
Sr.
No.
List of Programs Page No. Date Remarks
Sessional Evaluation
Internal Evaluation (I) External Evaluation (E)
Sr. No. Criteria Marks Sr. No. Criteria Marks
Written and
1.
1. Teacher’s 25 Machine Test 25
25
Assessment Marks 2. Marks
Viva
CREDIT 1
Design Test Cases for Purchase Order
Management based on System Specification
1. Enter 1st no
2. Enter 2nd no
3. Enter or pass additon(+button)
4. Check the final result is ok or not.
Negative no.
TC-01 Login failed Any valid Its should Login name Pass
login name accept login accepted
name
Following are the Test case for Validate Login Procedure for E-
Commerce Application:-
#include<stdio.h>
#include<conio.h>
int main( )
{
int a,b,c,c1,c2,c3;
do
{
printf("enter the sides of triangle\n");
scanf("%d%d%d",&a,&b,&c);
c1=((a>=1) && (a<=10));
c2=((b>=1) && (b<=10));
c3=((c>=1) && (c<=10));
if(!c1)
printf("value of a is out of range");
if(!c2)
printf("value of b is out of range");
if(!c3)
printf("value of c is out of range");
}while(!c1 || !c2 || !c3);
if((a+b)>c && (b+c)>a && (c+a)>b)
{
if(a==b && b==c)
printf("Triangle is equilateral\n");
else if(a!=b && b!=c && c!=a)
printf("Triangle is scalene\n");
else
printf("Triangle is isosceles\n");
}
else
printf("Triangle cannot be formed \n");
getch( );
return 0;
In Triangle program for BVA, we start by taking nominal values for a and b variables then cross product it
with values min, min-, nom, max- and max values of variable c. similarly keeping nominal values for
variables a and c, we cross product it with min, min-, nom, max-, max values of variable b. Again keeping
variable b and c as nominal combine with 5 values of a. By this we get 15 test cases in which a test case
with all nominal values for a, b and c is repeated thrice, so we discard 2 duplicate such cases and finally we
get 15-2=13 test cases which is equal to BVA i.e., 4(3)+1=13.
#include<stdio.h>
#include<conio.h>
int main()
{
int locks, stocks, barrels, t_sales, flag = 0;
float commission;
printf("Enter the total number of locks");
scanf("%d",&locks);
if ((locks <= 0) || (locks > 70))
{
flag = 1;
}
printf("Enter the total number of stocks");
scanf("%d",&stocks);
if ((stocks <= 0) || (stocks > 80))
{
flag = 1;
}
printf("Enter the total number of barrelss");
scanf("%d",&barrels);
if ((barrels <= 0) || (barrels > 90))
{
flag = 1;
}
if (flag == 1)
{
printf("invalid input");
getch();
}
t_sales = (locks * 45) + (stocks * 30) + (barrels * 25);
if (t_sales <= 1000)
{
commission = 0.10 * t_sales;
}
else if (t_sales < 1800)
{
commission = 0.10 * 1000;
commission = commission + (0.15 * (t_sales - 1000));
}
Considering Commission program, we have three input variables lock, stock and barrels. Range of value for
locks= 1-70, stocks= 1-80 and barrels= 1-90
Considering output variable sales we have 3 slots for calculating commission. i.e., if sales are below 1000,
com is 10%, if sales are 1001 to 1800 then com is 15% and if sales are greater than 1801, com is 20%.
Min (Locks, Min+ (Locks, Nom (Locks, Max- (Locks, Max (Locks,
Sales
Stocks, Barrels) Stocks, Barrels) Stocks, Barrels) Stocks, Barrels) Stocks, Barrels)
2, 1, 1 9, 10, 10
1-1000 1, 1, 1 1, 2, 1 5, 5, 5 10, 9, 10 10, 10, 10
1, 1, 2 10, 10, 9
11, 10, 10 10, 11, 10 17, 18, 18
1001-
10, 11, 10 10, 12, 10 14, 14, 14 18, 17, 18 18, 18, 18
1800
10, 10, 11 10, 10, 12 18, 18, 17
19, 18, 18 20, 18, 18 69, 80, 90
1801-
18, 19, 18 18, 20, 18 48, 48, 48 70, 79, 90 70, 80, 90
above
18, 18, 19 18, 18, 20 70, 80, 89
Inputs Output
Test
Description (Locks, Stocks, (Sales, Comments
Case Barrels) Com)
Test
Description Inputs Output Comments
Cases
Enter the values for locks(min), stocks(min), and Locks: 1, Stocks: Sales: 100,
BVA1 Valid
barrels(min) for the range 100 to 1000 1, Barrels: 1 Commission: 10
Enter the values for locks(min+), stocks(min), and Locks: 2, Stocks: Sales: 145,
BVA2 Valid
barrels(min) for the range 100 to 1000 1, Barrels: 1 Commission: 14.5
Enter the values for locks(min), stocks(min+), and Locks: 1, Stocks: Sales: 130,
BVA3 Valid
barrels(min) for the range 100 to 1000 2, Barrels: 1 Commission: 13
Enter the values for locks(min), stocks(min), and Locks: 1, Stocks: Sales: 125,
BVA4 Valid
barrels(min+) for the range 100 to 1000 1, Barrels: 2 Commission: 12.5
Enter the values for locks(nom), stocks(nom), and Locks: 5, Stocks: Sales: 500,
BVA5 Valid
barrels(nom) for the range 100 to 1000 5, Barrels: 5 Commission: 50
Enter the values for locks(max-), stocks(max), and Locks: 9, Stocks: Sales: 955,
BVA6 Valid
barrels(max) for the range 100 to 1000 10, Barrels: 10 Commission: 95.5
Enter the values for locks(max), stocks(max-), and Locks: 10, Stocks: Sales: 970,
BVA7 Valid
barrels(max) for the range 100 to 1000 9, Barrels: 10 Commission: 97.0
Enter the values for locks(max), stocks(max), and Locks: 10, Stocks: Sales: 975,
BVA8 Valid
barrels(max-) for the range 100 to 1000 10, Barrels: 9 Commission: 97.5
Enter the values for locks(max), stocks(max), and Locks: 10, Stocks: Sales: 1000,
BVA9 Valid
barrels(max) for the range 100 to 1000 10, Barrels: 10 Commission: 100
Enter the values for locks(min), stocks(min), Locks: 11, Stocks: Sales: 1045,
BVA10 Valid
and barrels(min) for the range 1000 to 1800 10, Barrels: 10 Commission: 106.75
Enter the values for locks(min), stocks(min+), Locks: 10, Stocks: Sales: 1030,
BVA11 Valid
and barrels(min) for the range 1000 to 1800 11, Barrels: 10 Commission: 104.5
Enter the values for locks(min), stocks(min), Locks: 10, Stocks: Sales: 1025,
BVA12 Valid
and barrels(min+) for the range 1000 to 1800 10, Barrels: 11 Commission: 103.75
Enter the values for locks(min+), stocks(min), Locks: 12, Stocks: Sales: 1090,
BVA13 Valid
and barrels(min) for the range 1000 to 1800 10, Barrels: 10 Commission: 113.5
Enter the values for locks(min), stocks(min+), Locks: 10, Stocks: Sales: 1060,
BVA14 Valid
and barrels(min) for the range 1000 to 1800 12, Barrels: 10 Commission: 109
Enter the values for locks(min), stocks(min), and Locks: 10, Stocks: Sales: 1050,
BVA15 Valid
barrels(min+) for the range 1000 to 1800 10, Barrels: 12 Commission: 107.5
Enter the values for locks(nom), stocks(nom), Locks: 14, Stocks: Sales: 1400,
BVA16 Valid
and barrels(nom) for the range 1000 to 1800 14, Barrels: 14 Commission: 160
Enter the values for locks(max-), stocks(max), Locks: 17, Stocks: Sales: 1755,
BVA17 Valid
and barrels(max) for the range 1000 to 1800 18, Barrels: 18 Commission: 213.25
Enter the values for locks(max), stocks(max-), Locks: 18, Stocks: Sales: 1770,
BVA18 Valid
and barrels(max) for the range 1000 to 1800 17, Barrels: 18 Commission: 215.5
Enter the values for locks(max), stocks(max), Locks: 18, Stocks: Sales: 1775,
BVA19 Valid
and barrels(max-) for the range 1000 to 1800 18, Barrels: 17 Commission: 216.25
#include<stdio.h>
int main()
{
int day, month, year, tomm_day, tomm_month, tomm_year;
char flag;
do
{
flag = 'y';
printf("\nenter today's date in the form of dd mm yyyy\n");
scanf("%d%d%d", &day, &month, &year);
tomm_month = month;
tomm_year = year;
switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
if(day < 31)
tomm_day = day + 1;
else
{
tomm_day = 1;
tomm_month = month + 1;
}
break;
case 4:
case 6:
case 9:
case 11:
if(day < 30)
tomm_day = day + 1;
else
{
tomm_day = 1;
tomm_month = month + 1;
}
BY: Yasharth Mishra (2102840100190) CS-A 4TH Year
break;
case 12:
if(day < 31)
tomm_day = day + 1;
else
{
tomm_day = 1;
tomm_month = 1;
if(year == 2015)
{
printf("the next day is out of boundary value of year\n");
tomm_year = year + 1;
}
else
tomm_year = year + 1;
}
break;
case 2:
if(day < 28)
tomm_day = day + 1;
else if(isleap(year) && day == 28)
tomm_day = day + 1;
else if(day == 28 || day == 29)
{
tomm_day = 1;
tomm_month = 3;
}
break;
}
printf("next day is: %d %d %d", tomm_day, tomm_month, tomm_year);
return 0;
}
Considering Date program, we have three variables day, month and year.
day 1 2 15 30 31
month 1 2 6 11 12
• Finding defects which may get created by the programmer while developingthe software.
• Gaining confidence in and providing information about the level of quality.
• To prevent defects.
• To make sure that the end result meets the business and user requirements.
• To ensure that it satisfies the BRS that is Business Requirement Specification and
SRS that is System Requirement Specifications.
• The test case is defined as a group of conditions under which a tester determines whether a
software application is working as per the customer's requirements or not. Test case designing
includes preconditions, case name,input conditions, and expected result. A test case is a first
level action and derived from test scenarios.
2. Test Objectives
3. Pre Condition
4. Url Optional
5. Test Step 5
6. Test Data
7. Expected Result
8. Actual Result
9. Pass or Fail
Following are the Test case of Purchase Order Management based onSystem Specification :-
Test Test Steps Inputs Expected Actual Status
Case Id Case Results results
name
TC-03 Item Cot Enter item “Prd -1” Product Accepting Pass
name in name
alphabets should be
accepted
4. Purchase Order: Reference Quantation item list & Quantation item list &Quantities terms
and conditions.
TC-01 Login failed Any valid Its should Login name Pass
login name accept login accepted
name
ii.) do..while
while(condition)
{
Loop body
Increment or decrement;
}
Example:
#include<stdio.h>
int main()
{
int counter, howmuch;
scanf("%d", &howmuch);
counter = 0;
while ( counter < howmuch)
{
counter++;
printf("%d\n", counter);
}
return 0;
}
iii) if…else
syntax:
if( condition 1 )
statement1;
else if( condition 2 )
statement2;
else if( condition 3 )
statement3;
else
statement4;
example:
#include<stdio.h> int
main(){
int x,y;
printf("Enter value for x :");
scanf("%d",&x);
printf("Enter value for y :");
scanf("%d",&y);
if ( x > y ){
printf("X is large number - %d\n",x);
}
else{
printf("Y is large number - %d\n",y);
}
return 0;
}
iv) switch
syntax:
swithch(int/char const)
{
Case const 1:stm1;
Break;
Case const 2:stmt2;
Break;
}
}
default: stmt n;
Break;
}
Example:
#include <stdio.h>
int main() {
int color = 1;
printf("Please choose a color(1: red,2: green,3: blue):\n");
scanf("%d", &color);
switch (color)
{
case 1:
printf("you chose red color\n");
break;
case 2:
printf("you chose green color\n");
break;
case 3:
printf("you chose blue color\n");
break;
default:
printf("you did not choose any color\n");
}
return 0;
}
v) for
Syntax:
Example:
#include <stdio.h>
int main()
{
int x;
/* The loop goes while x < 10, and x increases by one every loop*/ for ( x = 0; x
< 10; x++ )
{
Scope:
The software supports a computerized banking network called ‗Bank24„. The network enables
customers to complete simple bank account services via automated teller machines (ATMs) that may
be located off premise and that need not be owned and operated by the customer„s bank. The ATM
identifies a customer by a cash card and password. It collects information about a simple account
transaction (e.g., deposit, withdrawal, transfer, bill payment), communicates the transaction information
to the customer„s bank, and dispenses cash to the customer. The banks provide their own software for
their own computers. The
‗Bank24„ software requires appropriate record keeping and security provisions. The software must
handle concurrent accesses to the same account correctly.
Intended Audience:
The intended audience of this SRS consists of:
• Software designers
• Systems engineers
• Software developers
• Software testers
• Customers
The actors of the system are:
1. User
2. ATM Machine
3. Bank
Product Perspective:
An automated teller machine (ATM) is a computerized telecommunications device that provides the
customers of a financial institution with access to financial transactions in a public space without the
need for a human clerk or bank teller. On most modern ATMs, the customer is identified by inserting
a plastic ATM card with a magnetic stripe or a plastic smartcard with a chip, that contains a unique card
number and some security information, such as an expiration date or CVC (CVV). Security is provided
by the customer entering a personal identification number (PIN).
Product functions:
Using an ATM, customers can access their bank accounts in order to make cash withdrawals (or
credit
card cash advances) and check their account balances.
The functions of the system are:
1. Login
2. Get Balance Information
3. Withdraw Cash
4. Transfer Funds
Operating Environments:
The hardware, software and technology used should have following specifications:
• Ability to read the ATM card.
• Ability to count the currency notes.
• Touch screen for convenience.
• Keypad (in case touchpad fails)
• Continuous power supply.
• Ability to connect to bank„s network.
• Ability to validate user.
Design/implementation constraints:
Login:
Validate Bank Card
• Validate for Card Expiration Date
• Validate that the card's expiration date is later than today's date
• If card is expired, prompt error message "Card is expired" Validate
for Stolen or Lost Card
• Validate that the card is not reported lost or stolen
• If card is lost, prompt error message, "Card has been reported lost"
• If card is stolen, prompt error message, "Card has been reported
stolen"Validate for Disabled Card
• Validate that the card is not disabled
• If card is disabled, prompt error message, "Card has been disabled
as of <expirationdate>"
Validate for Locked Account
• Validate that the account is not locked
• If account is locked, prompt error message "Account is locked" Validate PIN
• Validate that the password is not blank
• If PIN is blank, prompt error message "Please provide PIN"
• Validate that the password entered matches the password on file
• If password does not match, prompt error message "Password is Incorrect"Lock Account
• If number of consecutive unsuccessful logins exceeds three attempts, lockaccount
Maintain Consecutive Unsuccessful Login Counter
Increment Login Counter
For every consecutive Login attempt, increment logic counter by 1.
Reset login counter to 0 after login is successful.
Get Balance Information
Withdraw Cash
Transfer Funds
Assumptions and Dependencies:
• Hardware never fails
• ATM casing is impenetrable
• Limited number of transactions per day (sufficient paper for receipts)
• Limited amount of money withdrawn per day (sufficient money)