Skip to main content

Unit Tests

Unit Test Reports​

You can find the generated unit test report here.

Blockly Compiler​

Hex to RGB Conversion​

Details
  • Check that the compiler is able to convert Hexadecimal color values into a 4-tuple of red, green, blue, and alpha values in the range 0-255.
    • Input / User action​

      • Hexadecimal color value. E.g: #000000
    • Expected Result​

      • A 4-tuple is returned. E.g: [0, 0, 0, 255]

Scale Bitmap​

Details
  • Check that the compiler is able to scale a bitmap to a new size.
    • Input / User action​

      • Bitmap in 2d array form and a whole integer scaling factor.
    • Expected Result​

      • A 2d array of the same bitmap, scaled to new dimensions.

Bitmap String Representation​

Details
  • Check that the compiler is able to convert a 2d array bitmap into a string representing that 2d array. This is used to insert bitmap data into python code.
    • Input / User action​

      • Bitmap in 2d array form.
    • Expected Result​

      • A string representing that bitmap in the form "[[0,0,],[x,x], ... ]"

Unroll Workspace Blocks​

Details
  • Check that the compiler is able to convert a nested workspace structure into an iterable list of blocks.
    • Input / User action​

      • Blockly workspace JSON
    • Expected Result​

      • An array of blocks contained in the workspace.

Find Path to Exit​

Details
  • Check that the compiler is able to navigate a nested workspace structure and determine if the a Close Game block is reached.
    • Input / User action​

      • Blockly workspace JSON
    • Expected Result​

      • A boolean value indicating that the Close Game block is reachable.

Get Variable Name​

Details
  • Check that the compiler is able to map a Block's UUID to a stored variable name in the workspace.
    • Input / User action​

      • Block UUID and the workspace JSON it belongs to.
    • Expected Result​

      • A predefined variable name present in the workspace that maps to that block.

Get Bitmap Size​

Details
  • Check that the compiler is able to retrieve size information from the block definitions array based on the block type.
    • Input / User action​

      • Block type and the block definitions array.
    • Expected Result​

      • A 2d array representing the size of the bitmap. E.g: A block with the type "large_bitmap" should have a size of [16, 16].

Compile a Game​

Details
  • Check that the compiler is able to generate python code from a workspace.
    • Input / User action​

      • The file name of the workspace JSON and an optional destination file name.
    • Expected Result​

      • A python program defined by the workspace blocks.

Compiled Game Runs​

Details
  • Check that the compiler generated a valid python program from a workspace.
    • Input / User action​

      • The file name of the generated python program.
    • Expected Result​

      • A boolean value indicating that the program ran for at least 5 seconds or failed to run.

Flask Server​

Flask Server Starts​

Details
  • Check that the Flask server starts.
    • Input / User action​

      • N/A
    • Expected Result​

      • A boolean value indicating that Flask server is running on port 8000 and that it is serving data.

Retrieve Saved Workspaces (Games)​

Details
  • Check that the Flask server correctly exposes saved workspaces through the /games endpoint.
    • Input / User action​

    • Expected Result​

      • An array of objects containing a workspace's name, author, description, and time last modified.

Retrieve Games from Community Hub​

Details
  • Check that the Flask server correctly exposes workspaces (Games) in the Community Hub.

Retrieve Games from a Classroom​

Details

Access Editor From External Device​

Details
  • Check that the Flask server correctly serves the editor.
    • Input / User action​

    • Expected Result​

      • Game selection menu is displayed, allowing the user to choose a saved workspace to edit or create a new one.

Access Editor From BlastPad​

Details

Access Home Screen​

Details
  • Check that the Flask server correctly serves the home screen.

Save Game​

Details
  • Check that the Flask server correctly saves a workspace.
    • Input / User action​

    • Expected Result​

      • The POSTed workspace is compiled and saved. Errors in compilation will cause the save request to fail and return 400.

Download Game​

Details

Run Compiler on Saved Game​

Details
  • Check that the Flask server is able to compile a saved game.

Get Local WiFi Networks​

Details
  • Check that the Flask server is able to scan for local wifi networks.