You are on page 1of 15

ICT2810- Software Technology Assignment 1

Scripting, Testing and Version Control


Cheena Niraula , s51123566
Chin Wei Lian , s5111405

Content

1. Problem Statement.............................................................................................1
2. User Requirements.............................................................................................2
3. Software Requirements......................................................................................2
4. Software Design.................................................................................................3
5. Requirement Acceptance Tests.........................................................................5
6. Detailed Software Testing..................................................................................6
7. User Instructions.................................................................................................7

1. Problem Statement

The goal of the word ladder program (ladder gram) was to change the source word (in the
program, we called “start” word) into the target word step by step. Each step involves a letter
substitution. This program would print out the shortest solution path (which mean a list of
existing words) and the minimum number of transformations if the target word was found.
The user only can input existing words in the dictionary file (dictionary.txt) as the source and
target word. Once the user enters a word that does not exist in the dictionary, an error message
will be printed out until a valid word was entered. Users also can supply a list of words which
the users do not want these words presented within the solution path. Besides, users have an
option to select a word which must exist within the solution path. Also, the user has option of
asking for list of allthe possible unique paths.
2. User Requirements

The following outlines the user requirements for the program:

 The users must have the dictionary file in the same directory with the program.
 The user must install python intrepreter to run the program.
 The users must enter exact file name in order to run the program.
 The users cannot enter the word with less than 2 letters.
 The users can only enter the word that exists within the dictionary file.
 The target word only can be accepted when it contain same letters number with the
source word.
 If the users want to supply a list of words that are not allowed to be used, a format
should be followed.
 The user can either supply a word that must exist on the solution path or ignore that
function.

3. Software Requirements

The following outlines the software requirements for the program:

1. The program shall display error message if the user enter non-existing file name.
2. The program shall check the user input until the appropriate input is entered.
3. The program should not include any word from list of words that are not allowed to be
used in the solution path.
4. The program shall print out the solution path which contain the word that must exist if
the user provided the word.
5. The program must able to print out the shortest solution path from the source to target
word.
4. Software Design

High Level Design – Logical Block Diagram


List of all functions in the software
There are different functions used to build a ladder-gram. The name of the functions and their
description are described as follows:-
1. file_check_error( )

This function checks the entered file name if it is valid within the directory. Filename
is an string which taken as an input from the user. If the user inputs a valid filename ,
the particular file is opened otherwise filenotfoundError message will popup.

2. check_start_word(parameter 1:string – start word)

User is prompted to input a word. This function used that word user entered to check
the word to make sure it is non-digit and exist in the dictionary. Also checks the length
of the source word.

3. check_target_word(parameter 1:string -target word, parameter 2: list – same length


word list, parameter 3: string -start word )

User is prompted to input a word. This function checks the length of input word to
ensure that it has same length as the start word and within the dictionary. The input is
taken as a string. If the length is different , the error message is displayed.

4. check_absent_word(parameter 1: list – word list that not allowed to appear,


parameter 2: string- start word, parameter 3 :string- target word, parameter 4: list –
same length word list )

This functions checks the entered words and the list will be returned after each word
in the list is fully meet requirements. It iterates each of the word in a list. If the length
of word not equal to the length of "start" or "target" word then error message pop up.

5. check_intermediary_word(parameter 1: string- “yes” or “no”, parameter 2: string-


start word, parameter 3 :string- target word, parameter 4: list – same length word
list, parameter 5: list – word list that not allowed to appear )

This is a function that check intermediary word if it meets requirements. The start and
target words could not be same. The length should also be same otherwise it displays
the message requesting user to try again.

6. build (parameter 1: string – a word with wildcard ,parameter 2: list – same length
word list , parameter 3: set – a set of seen word, parameter 4: list- a list of one word
different words)

This function that will return word that is one word different from specific word. Data
type of the return value is string.

7. find(parameter 1: string- specfiic word ,parameter 2: list – same length word list ,
parameter 3: set – a set of seen word))

This is a function that return one letter different word list from the specific word. eg.
specific word= hide 'aide', 'bide', 'eide', 'nide', 'ride', 'side', 'tide', 'vide', 'wide', 'hade',
'hike', 'hire', 'hive' will be returned and added into list.
8. bfs(parameter 1: string- start word, parameter 2 :string- target word, parameter 3:
list – same length word list , parameter 4: set – a set of seen word)

The "Breadth First Search” method is used to find the shortest path to target word
from the start word. It adds current possible paths into queue and pop the first item (it
prevent infinite loop)in queue to check if it reach the target word. If the queue is
empty, it returns false message.

List of all data structures in the software (eg linked lists, trees, arrays etc)
The program uses array, dictionary,list . To store the words array are used. The same length
words are also stored in an array named same_length_words. It is used by check_start_word()
function. The data members used here are word and words.

Array has also been used for storing thereturned list of absent word after checking. The
function used is check_absent_words(). The data members are
word_list,start,target,same_length_word. Word_list checks the start and end word from the
string . same_length_word checks if the provided words are of the same length or not. Start is
the start word and trget is the target word.

Similarly, another array named “combination_list” is used for storing specific words.
Function find() is used here with the data members being specific_word, same_length_words,
seen.

Detailed Design – Pseudocode for all non-standard and non-trivial algorithms


that operate on datastructures

Function checkFile():
Check if the file name is valid:
Return the file name
Else:
Loop until valid filename is entered

Function checkStartWord(Argument 1):


If argument 1 is in the dictionary and has more than 2 letter :
Return argument 1
Else:
Display error messaage and let user input again

Function checkTargetWord(Argument 1, Argument 2, Argument 3):


If argument 1 is in argument 2 and not equal to argument 3 :
Return argument 1
Else:
Display error messaage and let user input again

Funcction checkAbsentWordList(Argument 1, Argument 2, Argument 3,Argument 4)


If Argument 1 not include argument 2 and argument 3 , in instance of argument 4:
Return argument 1
Else:
Display error messaage and let user input again
Function checkIntermediaryWord (Argument 1, Argument 2, Argument 3,Argument 4,
Argument5):
If argument 1 == no:
Return False to stop the loop
Elif argument 1 = yes:
Print prompt (“enter word that must exist”)
If the input value not equal to argument 2 and argument 3, in instance of argument4 but
Not in argument 5:
Return the input value
Else:
Display error messaage and let user input again

Function buildgraph (Argument 1, Argument 2, Argument 3,Argument 4):


Using regex to return the one difference letter word

Function find (Argument 1, Argument 2, Argument 3,Argument 4):


For each character in the word:
Replace the character with “.” and send it the function buildgraph to create a one letter
difference word list.
End for each loop
Return the one letter difference word list.

Function BreadthFirstSearch(Argument 1, Argument 2, Argument 3,Argument 4):


Add the argument 1 into queue
While queue:
Path variable hold the first element of queue by using pop.left() function
A variable called possibly_target contain the last element of the path.
If possibly_target equal to target word:
Return path
For each element in the list retrun from find() function by sending the possibly_target as
the first parameter.
Add every element into seen set
Append the existing path with the current element into the queue.
If queue is empty:
Retrun False

{
In the main function

print prompt "Enter file name"


Take the input from user and send it to checkFile() function
print prompt "Enter start word"
Take the input from user and send it to checkStartWord() function
Create a same length list
print prompt "Enter target word"
Take the input from user and send it along with start word and same length
list to checkTargetWord() function
print prompt "Enter the words that not allowed to appear in the path"
Take the input from user and send it along with start word ,target word
and same length list to checkAbsentWordList() function
Add every element in the absent word list into seen
print prompt "Enter the words that must be appeared in the path"
Take the input from user and send it along with start word ,target word,
same length list and absent word list to checkIntermediateryWord()
function

If intermediate word is provided:


Send start word, intermediate word , same length word list and seen to
Bfs function
Store the path in temporary variable
Send intermediate word, target word , same length word list and seen to
Bfs function
Store the path in second temporary variable
Print out the combination of two tempory variable

Else:
Send start word, target word , same length word list and seen to
Bfs function
Print out the path
}

Configuration management and version control

Configuration management is considered as process used for establishing and managing the
consistent product performance. It is used to manage changes throughout the lifecycle of the
project/product. The changes can be tracked through the configuration management tool.

Version control is a component of the Software Configuration management. This system


records any changes that is made to the files , saves it so that it can be used as a reference in
future.

Version control tools are available to control and track changes that are made. For the project,
bitnucked is used as a version control tool. One can commit any changes made in the process
of developing the program. Commit can be done through the use of “git”. All the changes can
only be executed once commit is done. Messages can be writeten in every commit so that the
user know exact reason for the change and commit. Local repository is created to store the
file. git clone command is used to connect the repository with the command line. Code is
written in command line . Initial commit can be seen and also the future commit can be seen
in the repository . The date of the commit can be seen in the repository.

The screenshot of the version control activities through the use of bitbucket is given as
follows:-
The screenshot above, shows the initial commit on readme.md file .The dictionary.txt is the
provided file and is attached in the repository named “assignment1” We can see the
description in the message section and the date of changes in the last commit section.
First modification is adding input checker ensure the input value is accepted.
Second modification is adding conditional statement restrict meaningless word change by
using increment counter. If counter of word change is more than four, the word should be
match 2 or more character with the target word.
After approved by the convenor to remove the existing function. I had removed partial
function and add queue function into it.
Start adding additional feature into the program. Users are allowed to supply a list of word
that cannot be appeared in the path.

Another additional feature is added into the program. Also, add comments in every line so my
group member or tutor can easily understand.
5. Unit Tests

No Test Case Expected Results Actual Results


1.0 Word_Ladder
1.1 Test a wrong filename Exception Handled Exception Handled
1.2 Test empty input file Display error message unable to locate Display error message and exit
file.
2.0 Test start word
2.1 Input more than 2 letters Display error message Display error message and exit
2.2 Input in digit Display error message Display error message and exit.
3.0 Check target word
3.1 Length not same Same length Display error message
3.2 Is digit Display error message Display error message
4.0 Check absent word
4.1 Same target or start word Display message warning Display error message
4.2 Test word in dictionary not Display error message Display error message
found
5.0 Test intermediary word

5.1 Same target and start word Display try again message Display try again message
5.2 Unexpected input Display ‘y’and’n’ option Display error message
6.0 Test build
6.1 Find word pattern return word that is one word different return word that is one word
from specific word different from specific word
7.0 Test find
7.1 Find word in range return one letter different word list from return one letter different word list
the specific word from the specific word
8.0 Test bfs
8.1 Test path Find the shortest path Finds the shortest path to target
word.

6. Requirement Acceptance Test

Software Test Implemented Test Results Comments (for partial


Requiremen (Full /Partial/ (Pass/ Fail) implementation or failed test
t No None) results)
1 Display error message if the user enter non-existing file Full Pass
name.
2 Check the user input until the appropriate input is Full Pass
entered.
3 Exclude any word from list of words that are not Full Pass
allowed to be used in the solution path.
4 Print out the solution path which contain the word that Full Pass
must exist if the user provided the word.
5 Able to print out the shortest solution path from the Full Pass
source to target word.
7. User Instructions
The user needs to follow following instructions in order to run the file:-
 Enter the name of the file i.e. dictionary.txt
 Enter the source word
 Enter the target word
 User can input the list of words not allowed for being used from start to the target
word.
 User can either answer “y” to provide a word that must exist in the path or “n” to
ignore the function.
 Shortest solution path is will be printed out.

You might also like