Skip to content

heig-tin-info/baygon2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Baygon

GitHub issues GitHub pull requests GitHub last commit Documentation Codecov PyPI Python License

Kills Bugs Dead!

Baygon

Baygon is a minimalist functional test suite for executables. Write your test scenarios as a concise YAML or JSON file, point the runner at the program you want to verify, and get colourful, readable results that make grading student assignments and validating CLI tools a breeze.

Features

  • ⚙️ Describe tests in YAML or JSON using a compact DSL with powerful matchers.
  • 🧪 Validate any executable: binaries, scripts, Python modules, or shell pipelines.
  • 🧮 Assign scores to tests and sections to support automated grading workflows.
  • 📦 Ship with an ergonomic CLI powered by Typer and rich terminal output provided by Rich.
  • 📚 Extensive documentation with cookbook-style guides and scripting tips.

Installation

Baygon is available on PyPI and supports Python 3.10 and later.

pip install baygon

If you use uv, you can install Baygon in an isolated environment:

uv tool install baygon

Quick start

Assume you want to test the following simple C program that prints the sum of its arguments and reports a version string:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    if (argc > 1 && strcmp(argv[1], "--version") == 0) {
        fprintf(stderr, "Version 0.1.1\n");
        return 0;
    }
    if (argc != 2 + 1) return 1;
    printf("%d", atoi(argv[1]) + atoi(argv[2]));
}

Create a test.yml file describing the desired behaviour:

version: 1
tests:
  - name: Arguments check
    tests:
      - name: No errors if two arguments
        args: [1, 2]
        exit: 0
      - name: Error if less than two arguments
        args: [1]
        exit: 1
  - name: Stdout is the sum of arguments
    args: [1, 2]
    stdout:
      - equals: "3"
  - name: Version on stderr
    args: ['--version']
    stderr:
      - match: 'm/\b\d\.\d\.\d\b/'
      - contains: 'Version'

Compile your program and run the test suite:

$ cc app.c -o a.out
$ baygon -v ./a.out
Test 1: Arguments check
  Test 1.1: No errors if two arguments.......... PASSED
  Test 1.2: Error if less than two arguments.... PASSED
Test 2: Stdout is the sum of arguments.......... PASSED
Test 3: Version on stderr....................... PASSED

Ran 4 tests in 0.01s.

ok.

Baygon automatically detects the test file in the working directory (test.yml, test.yaml, test.json, …) and executes each test sequentially.

Documentation

The full documentation, including the DSL reference, scripting tips, and advanced configuration guides, lives at https://heig-tin-info.github.io/baygon/.

Development

Baygon uses uv to manage development environments. Create a virtual environment and install all dependencies (including documentation and testing extras) with:

uv venv
source .venv/bin/activate
uv sync --all-extras --group dev

Local documentation preview

uv run mkdocs serve

Tests and coverage

uv run pytest

The default pytest configuration collects coverage reports with pytest-cov. You can inspect the HTML report by running uv run pytest --cov-report html and opening htmlcov/index.html.

License

Baygon is released under the MIT License.

About

Attempt to a new version of Baygon

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages