Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GSpec

A simple testing library for Godot.

Run Tests

Install

Copy the addons/gspec directory from this project into your project's addons directory.

Usage

To run your tests, execute this in the command line:

godot --headless -s addons/gspec/run_specs.gd

Your first test

In the root of your project, create a spec directory and a *_spec.gd file anywhere within that directory.

For example: spec/example_spec.gd

extends "res://addons/gspec/gspec.gd"

func test_fails():
  should_eq(2, 2) # Passes
  should_eq(3, 2) # Fails

Before and After

You may optionally add behavior to execute before and after your tests.

extends "res://addons/gspec/gspec.gd"

func before():
  # Do something before each test
  pass

func after():
  # Do something after each test
  pass

func before_all():
  # Do something once, before any test runs
  pass

func after_all():
  # Do something once, after every tests runs
  pass

func test_fails():
  should_eq(2, 2)
  should_eq(3, 2)

Development

Tests

godot --headless -s spec/gspec_test.gd

About

A simple testing library for Godot

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages