Skip to content

Latest commit

 

History

History
130 lines (86 loc) · 10.3 KB

TESTING.md

File metadata and controls

130 lines (86 loc) · 10.3 KB

Testing

Validator testing

  • 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: Screenshot of early run.py testing

      Running the contents of this file in the PEP8 online tool will produce the above results.

    • Potential non-error errors

      1. The following errors occured in run.py, requestservice.py, and sentencegenerator.py: Screenshot of run.py errors Screenshot of requestservice.py error Screenshot of sentencegenerator.py error

        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.

        Screenshot of related PEP 3107 section

        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:

        Screenshot of run.py test

      2. This error occurred in gamedictionary.py and hintservice.py: Screenshot of gamedictionary.py error Screenshot of hintservice.py error

        PEP 526 explains that this is valid form for variable annotations as can be seen here:

        Screenshot of relevant PEP 526 section

        For this reason, this error can also be ignored.

    • All other classes

      • classes/sentence.py - Sentence() Screenshot of sentence.py class test
      • classes/translation.py - Translation() Screenshot of translation.py class test
      • classes/word.py - Word() Screenshot of word.py class test
      • classes/enums/difficulty.py - Difficulty(Enum) Screenshot of difficulty.py class test
      • classes/enums/inputmode.py - InputMode(Enum) Screenshot of inputmode.py class test
      • classes/enums/language.py - Language(Enum) Screenshot of language.py class test
      • classes/enums/partofspeech.py - PartOfSpeech(Enum) Screenshot of partofspeech.py class test
      • classes/helpers/translationhelper.py - TranslationHelper() Screenshot of translationhelper.py class test

Testing for user stories

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.

Design

  1. 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.

    Screenshot of first design user story Screenshot of attached evidence

  2. 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.

    Screenshot of another user story Screenshot of commented evidence

    Which leads us nicely onto the 'real' testing; development.

Development

  1. 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.'

    Screenshot of first development user story Screenshot of code with function names Screenshot of part of code calling functions in main() Screenshot of 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.

  2. 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:

    Screenshot of user story for main menu navigation Screenshot of user story for toggling game input mode Screenshot of user story for toggling game hints Screenshot of user story for toggling game difficulty level

    Old navigation (which matches the descriptions given in the above user stories): Screenshot of old game options menu navigation

    Updated navigation (less jumping about thanks to use of prompt-toolkit library): Screenshot of new game options menu navigation

    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.

  3. 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:

    Screenshot of user story for basic user input Screenshot of evidence of commits for basic user input Commits can be seen here.

    GIF showing user input gameplay mode with translations

Unfixed bugs

  1. 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.

  2. 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.