xfail

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README

🫥 XFail

Testo plugin for marking tests as "expected to fail". Similar to Pytest xfail functionality

Such tests will not affect exit code of go test command in case of a failure.

Quick Start

go get github.com/ozontech/testo-toppings
type T struct {
    *testo.T
    *xfail.PluginXFail
}

type Suite struct { testo.Suite[T] }

func (Suite) Test(t T) {
    t.XFail()

    t.Fail("oops")
}
=== RUN   Test
=== RUN   Test/Suite
=== RUN   Test/Suite/testo!
=== RUN   Test/Suite/testo!/TestExample
    example_test.go:19: oops
    example_test.go:19: xfail: test "Test/Suite/TestExample" failed as expected, skipping
--- PASS: Test (0.00s)
    --- PASS: Test/Suite (0.00s)
        --- PASS: Test/Suite/testo! (0.00s)
            --- SKIP: Test/Suite/testo!/TestExample (0.00s)

See also examples.

Documentation

Overview

Package xfail provides plugin for pytest-like xfail functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithStrict

func WithStrict() testoplugin.Option

WithStrict will enable strict mode for xfail.

In strict mode xfail will fail the test if it was marked with XFail and did not fail.

Types

type PluginXFail

type PluginXFail struct {
	*testo.T
	// contains filtered or unexported fields
}

PluginXFail is a plugin implementation to embed in T.

func (*PluginXFail) Plugin

func (x *PluginXFail) Plugin(
	parent testoplugin.Plugin,
	options ...testoplugin.Option,
) testoplugin.Spec

Plugin implements testoplugin.Plugin.

func (*PluginXFail) XFail

func (x *PluginXFail) XFail()

XFail signals that this test is expected to fail.

In strict mode, see WithStrict, passed tests marked with XFail are considered failed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL