Skip to content

Tests without suites#10

Draft
metafates wants to merge 17 commits into
mainfrom
non-suite-tests
Draft

Tests without suites#10
metafates wants to merge 17 commits into
mainfrom
non-suite-tests

Conversation

@metafates
Copy link
Copy Markdown
Member

@metafates metafates commented May 20, 2026

This PR adds a new functionality to run Testo tests without suites.

Example:

package main

import (
	"testing"

	"github.com/ozontech/testo"
)

type T = *testo.T

func TestSimple(t *testing.T) {
	testo.RunTest(t, func(t T) {
		t.Log("Hello from testo!")
	})
}

func TestMultiple(t *testing.T) {
	t.Run("First test", testo.Test(func(t T) {
		t.Log("Hello from the first test!")
	}))

	t.Run("Second test", testo.Test(func(t T) {
		t.Log("Hello from the second test!")
	}))
}

How it works

Underneath, it constructs a special singleton suite which contains a single test. This test has a dynamic name, taken from the parent (real) test, which invokes testo.RunTest.

For example, here name of testo test is also TestSimple:

func TestSimple(t *testing.T) {
	testo.RunTest(t, func(t T) {
		t.Log("Hello from testo!")
	})
}

Name of the test means what plugins would see upon reflection. E.g. Allure plugin would generate a report with suiteless TestSimple test.

If we need to rename it, we just call t.Run(t, testo.Test(func(t T) {})):

func TestMultiple(t *testing.T) {
	t.Run("First test", testo.Test(func(t T) {
		t.Log("Hello from the first test!")
	}))

	t.Run("Second test", testo.Test(func(t T) {
		t.Log("Hello from the second test!")
	}))
}

So here it's also "First test" for the first testo test, and "Second test" for the second test.

For plugins nothing should change, as they will get an empty-named (SuiteInfo.Name = "") with a single test. Works with allure plugin out of the box.

Note

This is work in progress & proof of concept.

@metafates metafates self-assigned this May 20, 2026
@metafates metafates marked this pull request as draft May 20, 2026 08:24
@metafates metafates added the enhancement New feature or request label May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant