SFT221 Workshop 1
SFT221 Workshop 1
Section: NBB
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
LINE NUMBER: 35
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:
TEST # 2
LINE NUMBER: 35
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:
LINE NUMBER: 36
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.
OUTPUT:
TEST # 4
LINE NUMBER: 35
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 OUTPUT:
LINE NUMBER: 36
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 OUTPUT:
TEST # 6
LINE NUMBER: 36
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 OUTPUT:
LINE NUMBER: 35 - 36
TEST DESCRIPTION: Removing the curly brackets doesn’t effect on the code as the out is expected
TEST OUTPUT:
BUG # 1
LINE # 11.
ORIGINAL CODE:
char buf[25];
int sz = strlen(prefix);
buf[i] = s[i];
buf[sz] = '\0';
FIXED CODE:
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
LINE # 36
ORIGINAL CODE:
FIXED CODE:
if (prefix == “ ”)
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
LINE # 36
ORIGINAL CODE:
FIXED CODE:
Toupper(S1[])
EXPLAINATION:
Adding toupper builtin function in ctype library. By this we can convert the string to uppercase or lower
case
BUG # 4
LINE # 36
ORIGINAL CODE:
FIXED CODE:
while (*s1[]) {
if (*s1[] == '\t') {
S1[];
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.