8000 Unit Testing · CorsixTH/CorsixTH Wiki · GitHub
[go: up one dir, main page]

Skip to content
Toby edited this page Jan 25, 2024 · 3 revisions

Unit Testing in CorsixTH

Unit testing provides developers with a mechanism for detecting regressions or new bugs automatically. Whenever code is re-factored or developed a new unit test which exercises that code, or validates a bug is fixed, should be added.

These tests are run automatically by the Github Actions workflow so any failures which are flagged need resolving.

Note this guide is aimed towards *nix based development. Additional material for Windows is welcome

This guide assumes you have successfully built and ran CorsixTH locally (see).

Installing busted

CorsixTH uses Busted as the testing framework. To install busted locally:

  • Install luarocks as the lua package manager, then install busted and luacheck. Install as follows on Ubuntu based systems

    sudo apt install luarocks
    sudo luarocks install busted
    sudo luarocks install luacheck
    
  • Install on macOS (luarocks can be installed in other ways)

    brew install luarocks
    luarocks install busted
    luarocks install luacheck
    

Running the unit tests

  • Run busted tests

    busted --verbose --directory=CorsixTH/Luatest
    
  • Run luacheck tests

    luacheck --quiet --codes --ranges CorsixTH
    

Clone this wiki locally

0