Flexible test framework that can be added into any existing project (tested w/ GM Studio 1)
Grab the latest .gmez
from Releases or download the source and build yourself. Drag the .gmez
into your IDE and import all resources (double click on extension, click on Import, Select All and click OK).
Confirm that you have a TEST
object, test_list
script, and hobo_dll
is added to Included Files.
Now you can start adding tests to your project.
To get started I recommend you write tests that will be run when the first room is initialized (add TEST
object to first room.) but nothing is preventing you from dynamically instantiating the TEST
object to run during specific sections of gameplay.
With a TEST
object inserted into a room you can add assertions to the test_list
script and they will be triggered on the next game run.
Tests will be run in order they appear in the script to allow for the following
do_thing("keypress", ord("I"));
obj_exists(obj_inventory_overlay);
do_thing("keypress", vk_escape);
it("should set user overlay flag to false", false, obj_player.draw_inventory_overlay);
Passes if expected == result
it("should set draw_map flag to false on create", false, draw_map);
Passes if
object_id
is ofobject_type
or has a parentobject_type
instance_of(obj_tile, ds_stack_pop(graph));
Passes if
instance_of(object)
obj_exists(obj_overlay);
Will dynamically lookup the instance_variable on the object (used in cases where variables are updated by events)
// either it OR should_be would work IF #on_create inventory_slot_count=1
it("should be 1", 1, obj_character.inventory_slot_count);
should_be(1, obj_character, "inventory_slot_count");
do_thing("keypress", vk_enter); // picking up an item
should_be(2, obj_character, "inventory_slot_count");
Hobo Test has some built-in helper functions to help basic gameplay using basic commands
Simulates a key press and release
// vk_* AND ord(char) work
simulate_keypress(vk_left);
simulate_keypress(ord('A'));
// mb_left | mb_right | mb_middle
simulate_mouse_click(mb_left, 10, 10);
First make sure you have 7zip
installed and added to your PATH
. You should be able to open Powershell and have the 7z
command return usage info.
Double-click / run clean_make.bat
and it should create a working hobo_test.gmez
from the local files for you to use
The .gmx
file may have a warning about editting it manually but.. dont worry its not that complicated. It's just XML so feel free to edit at will. Just know the compiler needs this info when it uses the gmez
Add more info here to help folks get started with gmx / GML basics