Fixture

munit.Fixture
abstract class Fixture[T](name: String) extends AnyFixture[T]

Fixture allows you to acquire resources during setup and clean up resources after the tests finish running.

Fixtures can be local to a single test case by overriding beforeEach and afterEach, or they can be re-used for an entire test suite by extending beforeAll and afterAll.

There is no functional difference between extending Fixture[T] or AnyFixture[T]. The only difference is that an IDE will auto-complete Unit in the result type instead of Any.

Value parameters

fixtureName

The name of this fixture, used for displaying an error message if beforeAll() or afterAll() fail.

Attributes

See also
Graph
Supertypes
class AnyFixture[T]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def afterAll(): Unit

Runs once after the test suite has finished, regardless if the tests failed or not.

Runs once after the test suite has finished, regardless if the tests failed or not.

Attributes

Definition Classes
override def afterEach(context: AfterEach): Unit

Runs after each individual test case.

Runs after each individual test case.

Attributes

Definition Classes
override def beforeAll(): Unit

Runs once before the test suite starts

Runs once before the test suite starts

Attributes

Definition Classes
override def beforeEach(context: BeforeEach): Unit

Runs before each individual test case. An error in this method aborts the test case.

Runs before each individual test case. An error in this method aborts the test case.

Attributes

Definition Classes

Inherited methods

def apply(): T

The value produced by this suite-local fixture that can be reused for all test cases.

The value produced by this suite-local fixture that can be reused for all test cases.

Attributes

Inherited from:
AnyFixture

Inherited fields

val fixtureName: String

Attributes

Inherited from:
AnyFixture