- PEP8 online
-
Initial cursory testing
As a person who hasn't used Python in about 7 years, preliminary testing was done while in the early stages of development to better understand what to keep in mind while coding.
Many errors, such as those shown below, were encountered and fixed here:
Running the contents of this file in the PEP8 online tool will produce the above results.
-
Potential non-error errors
-
The following errors occured in run.py, requestservice.py, and sentencegenerator.py:
However, in PEP 3107, it explains that this is the expected format for funciton annotations that specify a default value and the pystylecode (formerly pep8) tool in Gitpod shows no error on these lines.
This answer in StackOverflow also supports this.
For this reason, these errors outlined by the PEP8 online tool can be ignored.
The code causing this error in run.py has now been removed because it is no longer needed. Here is the updated test result as of 16/12/21:
-
This error occurred in gamedictionary.py and hintservice.py:
PEP 526 explains that this is valid form for variable annotations as can be seen here:
For this reason, this error can also be ignored.
-
-
All other classes
- classes/sentence.py - Sentence()
- classes/translation.py - Translation()
- classes/word.py - Word()
- classes/enums/difficulty.py - Difficulty(Enum)
- classes/enums/inputmode.py - InputMode(Enum)
- classes/enums/language.py - Language(Enum)
- classes/enums/partofspeech.py - PartOfSpeech(Enum)
- classes/helpers/translationhelper.py - TranslationHelper()
-
Throughout the design and development of this project, users stories were made to document the process. Here are some examples to show how user stories were tested in order to determine if the story had been achieved/completed.
Note: all users stories for design can be found here and development can be found here.
-
The first user story was simple: 'As a designer, I want to brainstorm what I want my command line application to be.'
After the initial project meeting with my mentor, it was clear that all of the ideas were well over the scope of this portfolio project and would be better saved for another. However, it still counted and evidence to show that it was completed was attached.
-
Once the idea set in stone, the following user story was required: 'As a designer, I want to create requirements in order to ensure that project goals are met.'
Without this step, it would've been impossible to work out how exactly to reach the goal of this project.
Which leads us nicely onto the 'real' testing; development.
-
The first thing to do was to create what the user would see before they start the game, i.e. a main menu, so the user story was: 'As a user, I want to see the game title and a main menu.'
Note: I know that not all user stories contain a general idea of tasks to complete as opposed to concrete code but I sometimes think of functions when coming up with ideas and run with it.
-
The next easy thing to do was to make it possible to get into and out of the 'GAME OPTIONS' menu and make the options within toggleable, so the user stories were as follows:
Old navigation (which matches the descriptions given in the above user stories):
Updated navigation (less jumping about thanks to use of prompt-toolkit library):
Note: Tasks are broken down into smaller tasks to help see the bigger picture and to not overwhelm myself by trying to tackle everything at once.
-
After that, the next best thing to do was start with the simplest mode of gameplay: user input. The user story was as follows: 'As a user, I want to be able to provide text input to play the game with.'
However, translation would come much later. All that was required was to prompt the user for a sentence as many times as was required for a given difficulty level. No screenshot was taken of this in its simplest form but its final form, with translation, can be seen below alongside commits for when its simplest form was made:
Commits can be seen here.
-
When playing the game in with auto-generated sentences, it would sometimes hang. On closer inspection, it seems to always happen when ADVERB type parts of speech where added to the sentence structure. I was not able to replicate when I wanted to get a screenshot of it.
To avoid this, code was added to remove ADVERB from the list of choices when randomly generating a sentence structure but it's hard to know for sure that the bug doesn't occur with other types of words. If the code hangs after displaying 'Question -question_num-', assume that it's this bug.
-
Flickering of the bottom toolbar (although not visible at all on Heroku site)
This issue is one that belongs to the prompt-toolkit library itself and has already been mentioned in the README.