0% found this document useful (0 votes)
22 views10 pages

SFT221 Workshop 1

Uploaded by

fefakik357
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views10 pages

SFT221 Workshop 1

Uploaded by

fefakik357
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Name: Suffian Ahmad

Section: NBB

Date: 13th JAN 2024.

Authenticity Declaration:
“I declare this submission is the result of my own work and has not been shared with any other student
or 3rd party content provider. This submitted piece of work is entirely of my own creation."
SOFTWARE TESTING

Program:
TEST # 1

TEST NAME: ADDING SPECIAL CHARACTER

LINE NUMBER: 35

CODE: char s1[] = { "%$#@%upended" };

BUG OR NOT: NOT

TEST DESCRIPTION: ADDED SPECIAL CHARACTERS AT THE STARTING OF THE STRING. AS % IS THE USED
IN FORMAT SPECIFYING. BUT THE PROGRAM IS WORKING AS IT IS SUPPOSED TO WORK. REASON FOR
THIS IS WHEN WE USE DOUBLE QUOTES, IT CREATES A STRING LITERAL, AND THE CHARACTERS WITHIN
THE DOUBLE QUOTES ARE TREATED AS LITERAL CHARACTERS, NOT AS FORMAT SPECIFIERS.

TEST RESULT:

PASS

OUTPUT:

%$#@%upended does not start with up

%$#@%upended does end with ed

TEST # 2

TEST NAME: ADDING NULL TERMINATOR

LINE NUMBER: 35

CODE: char s1[] = { "upend\0ed" };

BUG OR NOT: BUG

TEST DESCRIPTION: CONDUCTED THIS TEST AS NULL TERMINATOR IS USED TO INDICATE THAT THE
STRING AS ENDED. SO IF THE STRING CONTAINS \0 IT WOULD BE DIFFICULT FOR A NON TECHNICAL
PERSON AS THEY DON’T KNOW WHAT IS GOING ON THE BACKGROUND.

TEST RESULT:

FAIL

OUTPUT:

upend does start with up

upend does not end with ed


TEST # 3

TEST NAME: LEAVING PREFIX BLANK

LINE NUMBER: 36

CODE: char prefix[] = { "" };

BUG OR NOT: YES

TEST DESCRIPTION: Removing prefix. The output based on the code is correct but if the output is
presented to a nontechnical person, its going to confuse them a lot. The output should be “up“ the white
spaces should be ignored.

TEST RESULT: FAIL

OUTPUT:

upended does start with

upended does end with ed

TEST # 4

TEST NAME: FORMAT SPECIFIER

LINE NUMBER: 35

CODE: char s1[] = { "%dupended" };

BUG OR NOT: NOT

TEST DESCRIPTION: As strings are the most favourite things that that a hacker likes because strings gives
him/her the free hand to input any command which can be used to gather data or manipulate the code.
In this test adding a “%d” to see if any error pops up or not. But the program still handed it as a string.

TEST RESULT: PASS

TEST OUTPUT:

%dupended does not start with up

%dupended does end with ed


TEST # 5

TEST NAME: VERTICLE TAB

LINE NUMBER: 36

CODE: char prefix[] = { "up{%d,'sz'}[\t]" };

BUG OR NOT: YES

TEST DESCRIPTION: The string includes special characters like '%', ',' and '\t'. the escape sequence \t
represents a horizontal tab character. When included in a string, \t is interpreted as a command to insert
a tab character but in the string, it need to treated as a character instead it’s printing horizontal tab

TEST RESULT: FAIL

TEST OUTPUT:

upended does not start with up{%d,'sz'}[ ]

upended does end with ed

TEST # 6

TEST NAME: Prefix in Uppercase

LINE NUMBER: 36

BUG OR NOT: BUG

CODE: char prefix [] = {“Up" };

TEST DESCRIPTION: Even tough the string is same, but the first character is capitalized which effects the
output as the output of the code explains that the upended does not start with Up. This is because of
the Capitalization. To avoid this issue programmers use .upper while taking the input from the user so
that it can safe them trouble afterwards.

TEST RESULT: FAIL

TEST OUTPUT:

upended does not start with Up

upended does not end with Ed


TEST # 7

TEST NAME: Removing the curly brackets

LINE NUMBER: 35 - 36

BUG OR NOT: NOT

CODE: char s1[] = "upended" ;

char prefix[] = "up" ;

TEST DESCRIPTION: Removing the curly brackets doesn’t effect on the code as the out is expected

TEST RESULT: PASS

TEST OUTPUT:

upended does start with up

upended does end with ed


BUGS

BUG # 1

BUG NAME: NULL TERMINATOR.

LINE # 11.

ORIGINAL CODE:

char buf[25];

int sz = strlen(prefix);

for (int i = 0; i < sz; i++)

buf[i] = s[i];

buf[sz] = '\0';

return 0 == strcmp(buf, prefix);

FIXED CODE:

if (s == NULL || prefix == NULL)

return 0; // Handle NULL pointers to prevent crashes

EXPLAINATION:
The program checks for NULL pointers in the startsWith and endsWith functions to prevent crashes. if the
prefix or the string s is a NULL pointer. It helps in managing these situations and protects against crashes
that could happen from dereferenced NULL pointers.
BUG # 2

BUG NAME: Empty Prefix

LINE # 36

ORIGINAL CODE:

char prefix[] = "up" ;

FIXED CODE:

if (prefix == “ ”)

Printf(“No blanks allowed”);

Else

Return 0;

EXPLAINATION:
To check if the prefix is empty. If the prefix is empty, then an error message will be printed that prefix can’t
contain any blanks.

BUG # 3

BUG NAME: String in lowercase

LINE # 36

ORIGINAL CODE:

char s1[] = "upended" ;

FIXED CODE:

Char s1[] = "upended";

Toupper(S1[])

EXPLAINATION:
Adding toupper builtin function in ctype library. By this we can convert the string to uppercase or lower
case
BUG # 4

BUG NAME: Horizontal tab

LINE # 36

ORIGINAL CODE:

char s1[] = "upended\ted" ;

FIXED CODE:

int containsTab(const char *s1[]) {

while (*s1[]) {

if (*s1[] == '\t') {

return 1; // Tab character found

S1[];

return 0; // Tab character not found

EXPLAINATION:

The containsTab function determines whether the tab character ('\t') is present in a supplied string. It
uses a while loop to cycle through every character in the string. The function checks the entire string and
returns 1 if a tab character is found, and 0 otherwise.
Reflection

A reflection where you consider whether testing or inspection identified more bugs in this
case. State why you think one way worked better than the other. How could you improve the
technique that worked less well?

Answer: I believe that, both inspection and testing have their own categories. Software
testers have the most difficult job as they have to test all sorts of the information which a
user might interact with. For example, Penetration Testers are hired by the companies just
to check the security of their website as this is fundamental process and reliable so that a
user can share data encrypted. To answer this question I would say that inspection is better
if you just want the job done but testing comes handy when you try every terminology
which might effect your code and user interface.

Did you find it difficult to find the bugs in this assignment? If not, what helped find them
quickly? If you did find it difficult, what made finding the bugs so difficult?

Answer: At first searching for bugs was really difficult, it made me anxious and I started to
think about the job of Software tester in which he has to run 100’s of different test just to
make the software secure for the user. When I started to get frustrated, I just thought what
can I do to make this program crash at this point things started to get a lot crazy. I didn’t
do a good job but hopefully I learn more and more about software testing. The thing which
made me finds more bugs was the curiosity of just inserting different data or keywords that
might a receptionist enter at the registration of the user.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy