watplugin / wat

A Testing Plugin for Godot Game Engine
MIT License
316 stars 20 forks source link

THIS REPO IS NOT 4.0 COMPATIABLE!

Icon WAT

3.3.2

ko-fi

  1. Install
  2. Project Settings
  3. GUI
  4. CLI
  5. Example Tests
  6. Assertions

Install

  1. It is advised to download WAT from the Godot Asset Library.
  2. You may download WAT or WAT Mono from the release page.
  3. Extract the downloaded zip file.
  4. Add the addons folder from the extracted files to your Godot Project.
  5. Enable the Plugin in Project -> Project Settings -> Plugin Tab
  6. You should see a new "Tests" button in the bottom middle bar of the Godot Editor.

Project Settings

Once you have enabled the WAT Plugin, you will be able to see the settings in ProjectSettings -> General -> Wat (right at the bottom). If you don't see it, you may need to close the project settings and then re-open.

Graphical User Interface

Image

Top Left Menu ( Left To Right )

Run All Tests

Runs all tests directly in the Editor. WAT does not have access to the
debugger when run this way.

Note: A Rebuild might be required by any User who is using WAT Mono.

Debug All Tests

Runs all tests in the Scene. WAT does have access to the debugger when
run this way.

Select Tests

Users may select to Run (in editor) or Debug (in scene): previously failed tests, a set of tagged tests, a Directory, Script or a Method.

Note: Users may organize their tests into nested directories but this is only
for organizational purposes. WAT will *only* run the top-level tests of any directory.

Note: To edit the tags of a script, navigate to the script and then to Edit Tags. Check which tags you want the script to have (or uncheck those which you
don't want it to have)/

Filter Results

Users can choose to collapse all results, expand all results or expand only failures (which will collapse all results but expand the failed methods).

Repeat X Times

Users can choose to repeat a Test Run immediatly so many times. This can help
when testing erratic bugs where the problem only exists sometimes. Choose 0
to run the tests once.

Run on X Thread(s)

Users can set the count of threads to run their tests on (to the limit of their
processor core count - 1 for WAT itself otherwise it will stall).

Use 1 thread to not run on any additional threads.

Note: Do not use Repeats & Threads together. There is currently a bug.

Links

A Set of links that may or may not be useful to you.

Bottom Left Labels ( Left to Right )

Runs

The number of times tests have been run since WAT was open.

Total Tests

The number of total tests scripts ran in the previous Test Run.

Passed Tests

The number of total test scripts that passed in the previous Test Run.

Failed Tests

The number of total test scripts that failed in the previous Test Run.

Times

The time the Test Run is taking (or has taken if finished). This updates
live.

Command Line Interface

You can run tests in your command line interface by navigating to your Project Directory and executing the command: godot addons/cli.tscn [ARGUMENTS]

Run All Tests

godot addons/WAT/cli.tscn run=all

Run Directory

// Where X is the path of the directory you want to run
godot addons/WAT/cli.tscn run=dir+X

Run Script

// Where X is the project path of the script you want to run (Project Path meaning res:// path)
godot addons/WAT/cli.tscn run=res://script+X

Run Method

// Where X is the absolute path of the script where the method is contained
// and where Y is the name of the method
godot addons/WAT/cli.tscn run=method+X+Y

Run Failed

godot addons/WAT/cli.tscn run=failed

Run Tagged

// Where X is the name of the tag you want to run
godot addons/WAT/cli.tscn run=tag+X

Repeat Tests

godot addons/WAT/cli.tscn run=all repeat=2
OR
godot addons/WAT/cli.tscn run=all r=2

Note: Argument order does not matter so you can do this either
godot addons/WAT/cli.tscn r=2 run=all

Run on X Threads

godot addons/WAT/cli.tscn run=all thread=3
OR
godot addons/WAT/cli.tscn run=all t=3

Note: Argument order does not matter so you can do this either
godot addons/WAT/cli.tscn t=2 run=all

Examples

Assertions