munit

package munit

Members list

Packages

package munit.internal

Type members

Classlikes

class AfterEach(val test: Test) extends Serializable

Attributes

Supertypes
trait Serializable
class Object
trait Matchable
class Any
abstract class AnyFixture[T](val fixtureName: String)

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

AnyFixture 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.

It's preferable to use a sub-class like munit.Fixture or munit.FutureFixture instead of this class. Extend this class if you're writing an integration a third-party type like Cats Resource.

Value parameters

fixtureName

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

Attributes

See also
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Fixture[T]
class FutureFixture[T]
object Assertions extends Assertions

Attributes

Companion
trait
Supertypes
trait Assertions
class Object
trait Matchable
class Any
Self type
Assertions.type

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Assertions
trait BaseFunSuite
class FunSuite

Attributes

Supertypes
trait FunFixtures
trait Assertions
class Suite
class Object
trait Matchable
class Any
Show all
Known subtypes
class FunSuite
Self type
class BeforeEach(val test: Test) extends Serializable

Attributes

Supertypes
trait Serializable
class Object
trait Matchable
class Any
class Clue[+T](val source: String, val value: T, val valueType: String) extends Serializable

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any
object Clue extends ClueMacro

Attributes

Companion
class
Supertypes
trait ClueMacro
class Object
trait Matchable
class Any
Self type
Clue.type
class Clues(val values: List[Clue[_]])

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Clues

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Clues.type
trait Compare[A, B]

A type-class that is used to compare values in MUnit assertions.

A type-class that is used to compare values in MUnit assertions.

By default, uses == and allows comparison between any two types as long they have a supertype/subtype relationship. For example:

  • Compare[T, T] OK
  • Compare[Some[Int], Option[Int]] OK, subtype
  • Compare[Option[Int], Some[Int]] OK, supertype
  • Compare[List[Int], collection.Seq[Int]] OK, subtype
  • Compare[List[Int], Vector[Int]] Error, requires upcast to Seq[Int]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Compare extends ComparePriority1

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Compare.type

Allows comparison between A and B when A is a subtype of B

Allows comparison between A and B when A is a subtype of B

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Compare

Allows comparison between A and B when B is a subtype of A.

Allows comparison between A and B when B is a subtype of A.

This implicit is defined separately from ComparePriority1 in order to avoid diverging implicit search when comparing equal types.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Compare
class ComparisonFailException(val message: String, val obtained: Any, val obtainedString: String, val expected: Any, val expectedString: String, val location: Location, val isStackTracesEnabled: Boolean) extends ComparisonFailure, FailExceptionLike[ComparisonFailException]

The base exception for all comparison failures.

The base exception for all comparison failures.

This class exists so that it can extend org.junit.ComparisonFailure, which is recognised by IntelliJ so that users can optionally compare the obtained/expected values in a GUI diff explorer.

Value parameters

expected

the expected value from this comparison.

expectedString

the pretty-printed representation of the obtained value. This string is displayed in the IntelliJ diff viewer.

location

the source location where this exception was thrown.

message

the exception message.

obtained

the obtained value from this comparison.

obtainedString

the pretty-printed representation of the obtained value. This string is displayed in the IntelliJ diff viewer.

Attributes

Supertypes
class ComparisonFailure
class AssertionError
class Error
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
object Diffs

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Diffs.type
object Exceptions

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Exceptions.type
class FailException(val message: String, val cause: Throwable, val isStackTracesEnabled: Boolean, val location: Location) extends AssertionError, FailExceptionLike[FailException]

Attributes

Supertypes
class AssertionError
class Error
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Known subtypes
trait FailExceptionLike[T <: AssertionError] extends Serializable

The base class for all MUnit FailExceptions.

The base class for all MUnit FailExceptions.

Implementation note: this class exists so that we could fix the issue https://youtrack.jetbrains.com/issue/SCL-18255 In order to support the JUnit comparison GUI in IntelliJ we need to extend org.junit.ComparisonFailure, which is a class and not an interface. We can't make munit.FailException extend org.junit.ComparisonFailure since not all "fail exceptions" are "comparison failures". Instead, we introduced munit.ComparisionFailException, which extends org.junit.ComparisonFailure and this base trait. Internally, MUnit should match against FailExceptionLike[_] instead of munit.FailException directly.

Attributes

Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
Self type
AssertionError
class FailSuiteException(val message: String, val location: Location) extends FailException

Attributes

Supertypes
class AssertionError
class Error
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
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.

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
Supertypes
class AnyFixture[T]
class Object
trait Matchable
class Any
class Framework extends JUnitFramework

Attributes

Supertypes
trait Framework
class Object
trait Matchable
class Any
trait FunFixtures

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BaseFunSuite
class FunSuite
Self type
abstract class FunSuite extends BaseFunSuite

Attributes

Supertypes
trait BaseFunSuite
trait FunFixtures
trait Assertions
class Suite
class Object
trait Matchable
class Any
Show all
abstract class FutureFixture[T](name: String) extends AnyFixture[T]

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

FutureFixture 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 FutureFixture[T] or AnyFixture[T]. The only difference is that an IDE will auto-complete Future[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
Supertypes
class AnyFixture[T]
class Object
trait Matchable
class Any
class IgnoreSuite extends Annotation

Attributes

Supertypes
class Annotation
class Object
trait Matchable
class Any
object Location extends LocationMacro

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Location.type
final class Location(val path: String, val line: Int) extends Annotation, Serializable

Attributes

Companion
object
Supertypes
trait Serializable
trait Annotation
class Object
trait Matchable
class Any
class MUnitRunner(val cls: Class[_ <: Suite], newInstance: () => Suite) extends Runner, Filterable, Configurable

Attributes

Companion
object
Supertypes
trait Configurable
trait Filterable
class Runner
class Object
trait Matchable
class Any
Show all
object MUnitRunner

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Suite
trait BaseFunSuite
class FunSuite
trait Printable

Override this class to customize the default pretty-printer.

Override this class to customize the default pretty-printer.

Attributes

Supertypes
class Object
trait Matchable
class Any
abstract class Suite extends PlatformSuite

The base class for all test suites. Extend this class if you don't need the functionality in FunSuite.

The base class for all test suites. Extend this class if you don't need the functionality in FunSuite.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BaseFunSuite
class FunSuite

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BaseFunSuite
class FunSuite
Self type
class Tag(val value: String) extends Tag, Annotation, Serializable

Attributes

Supertypes
trait Serializable
trait Annotation
trait Tag
class Object
trait Matchable
class Any
Show all
final class Test(val name: String, val body: () => Future[Any], val tags: Set[Tag], val location: Location) extends Serializable

Metadata about a single test case.

Metadata about a single test case.

Value parameters

body

the function to be evaluated for this test case.

location

the file and line number where this test was defined.

tags

the annotated tags for this test case.

Attributes

Supertypes
trait Serializable
class Object
trait Matchable
class Any
final class TestOptions(val name: String, val tags: Set[Tag], val location: Location) extends Serializable

Options used when running a test. It can be built implicitly from a String (@see munit.TestOptionsConversions)

Options used when running a test. It can be built implicitly from a String (@see munit.TestOptionsConversions)

Value parameters

name

the test name, used in the UI and to select it with testOnly

tags

a set of munit.Tag, used to attach semantic information to a test

Attributes

Companion
object
Supertypes
trait Serializable
class Object
trait Matchable
class Any

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BaseFunSuite
class FunSuite
object TestOptions

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BaseFunSuite
class FunSuite
Self type
object TestValues

Values that have special treatment when evaluating values produced by tests.

Values that have special treatment when evaluating values produced by tests.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
TestValues.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait BaseFunSuite
class FunSuite
Self type

Value members

Concrete fields

val Fail: Tag
val Flaky: Tag
val Ignore: Tag
val Only: Tag
val Slow: Tag