Skip to content

Releases: watplugin/wat

Godot 4.0.0 - Now with Documentation!

19 Oct 16:40
Compare
Choose a tag to compare

Icon

Changelist

  • You can now Read The Docs

  • A Command Line Interface now exists for WAT with basic functionality

  • expects was changed to asserts to fall in line with other testing frameworks.

  • You can now double classes with constructor dependencies

  • You can now double inner classes

  • Timer was removed. It was practically useless and only slowed the tests down.

v3.0.0

23 Jun 19:52
3a401cf
Compare
Choose a tag to compare

Changelist

  • Runner now collects any script within the test folder if it extends from WATTest

  • You can now run single folders or scripts (this includes only running tests from the top level test folder)

  • Added expect.is_freed & expect.is_not_freed

  • Added expect.file_exists & expect.file_does_not_exist

  • Added signal_was_emitted_with_args (where args is position-specific array)

  • Added expect.is_x & expect.is_not_x where X is any builtin non-object type such as integers or Arrays. (expect.is_built_in_type is deprecated)

  • New Setting File located in WAT/Settings/Config.tres (Change this and then overwrite it
    on save to update settings via Godot's save resource button)

  • You can now use output(msg: String) in test scripts to print to the output panel

Inline Data

You can now repeat a test_method with the use of the parameters function or an expectation with the use
of the expect.loop method:

New Method: Parameters

The Parameter method is used when you want to use the same test but for different data. Use it at the
start of the test method that you want to repeat, passing it a 2D Array. The values of the first inner array are the keys you will be using to access the values. All of the other inner arrays are the data sets. When you want to access the parameters in your test, us p.[key] where key is one of the values in the array of keys. If you use a non-string key, use p.get(key) instead.

e.g

func test_addition():
    parameters([["a", "b", "c"], [5, 5, 10], [2, 2, 4], [7, 10, 12]])
    expect.is_equal(calculator.add(p.a, p.b), p.c, "%s + %s == %s" % [p.a, p.b, p.c])

is equivalent to

func test_addition():
    expect.is_equal(calculator.add(5, 5,), 10, "5 + 5 == 10")
    expect.is_equal(calculator.add(2, 2), 4, "2 + 2 == 4")
    expect.is_equal(calculator.add(7, 10), 12, "7 + 10 == 12")

When executed, you get:

(Note: The first time you call parameters, it sets the keys, the times after that, it just updates them)

New Method: loop

expect.loop allows you to do the same as above except with the expectation data. This can be helpful if only a subset of the data is varied. To use expect loop, pass the name of the
actual expect method you want to use along with a 2D Array of data sets (none of these should
be for keys, that is handled implicitly)

e.g

func test_addition():
    var calc = Calculator.new()
    var data = [[calc.add(5, 5), 10, "5 + 5 == 10"], [calc.add(2, 2), 4, "2 + 2 == 4"], [calc.add(7, 10), 12, "7 + 10 = 12"]]
    expect.loop("is_equal", data)

When executed, you get this:

Crashing Tests

You can now crash any test during its start method by passing in CRASH_IF_TEST_FAILS* at the end of any expect method. When a test crashes, the runner will dispose of it immediately and start the next test. Crashed Tests show up in the output
with a hazard warning icon:

(*This is a simple aliased const true bool).

Partial Doubles

You can now partially double scripts. Previously when doubled, scripts would lose all implementation. If you partially double a script it will default to its base implementation until you use default or stub on it. Currently, you can't reverse
this process. This is useful when you only want to stub a specific method out, like a shuffle mechanic, to make games more deterministic while keeping everything else in place.

Settings

  • Set main test folder (defaults to "res://tests")
  • Include test Subdirectories (when running tests)
  • Show subdirectories as separate tabs (if including subdirectories in tests)
  • Set list of valid test script prefixes (If used, only the tests with these prefixes will be run)
  • Set test method prefix (This must be set. Only methods with this prefix will be executed)
  • Keep Parameter's type when creating test doubles
  • Keep Return Value's type when creating test doubles
  • Exclude Void Return Value's when creating test doubles (Only applicable when keeping return value types)
  • Set Double Strategy to Partial

UI Updates

  • Redesigned UI to make use of TabContainer/Tabs
  • Added Icons for Passed, Failed & Crashed Tests
  • Added Timer that tracks total elapsed time of tests in (minutes : seconds : milliseconds)

v2.0.1

12 Jun 20:20
d3d5444
Compare
Choose a tag to compare

Fixed to use the correct new Expectations rather than the old system.

WAT 2.0.0

04 Jun 17:37
8394590
Compare
Choose a tag to compare

CHANGE LOG

New Features

  • There is now an expand/collapse all button to open/close all your completed tests for easy viewing.

Breaking Changes

  • We have altered the way collections (arrays, dict etc) are handled in some expectation methods. Previously we used to compare by length behind the scenes but this was essentially us lying to you about the results. Some of your tests dealing with dictionaries (which are compared by reference) may now fail. Your arrays should be fine.

  • Watch related expectation methods now require you to push in the emitter as well. This was largely due to internal re-arrangement but it should have been like that in the first place.

Other Changes

  • Output is now readonly.
  • You should no longer see the case error about blank.gd
  • WAT actively prevents invalid tests from being loaded (this was causing it to crash)
  • Expectation Methods are now Objects. This helps us with internal testing of WAT itself
  • Due to the aforementioned refactoring, another error that caused crashing was fixed
  • Significant amount of other internal refactoring
  • Broken tests no longer show as a success by default
  • Default settings buttons should no longer be clearing prefixes

WAT 1.0

20 May 15:53
7e63a00
Compare
Choose a tag to compare

The first stable release of WAT.