CheckOps
ScalaTest
ScalaTest is an Apache-2.0 testing toolkit for Scala and Java with many testing styles (FunSuite, FlatSpec, WordSpec and more), rich matchers and integration with sbt, Maven and IDEs.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
ScalaTest is the most widely used testing toolkit in the Scala ecosystem. It aims to be flexible, offering several testing styles so teams can choose the one that fits: AnyFunSuite for xUnit-like tests, AnyFlatSpec and AnyWordSpec for BDD-style specifications, AnyFreeSpec, AnyFeatureSpec for acceptance tests and others.
Assertions range from plain assert (with macro-enhanced failure messages) to a rich matchers DSL: result should be (5), list should contain allOf (1, 2), an [IllegalArgumentException] should be thrownBy { ... }. Fixtures can be shared through traits, BeforeAndAfter and loan patterns; async styles support Future-returning tests; and tags select tests. ScalaTest integrates with ScalaCheck for property-based testing (via scalatestplus), with Mockito through scalatestplus modules, and with sbt, Maven, Gradle, IntelliJ IDEA and Metals. It supports Scala 2.12, 2.13 and 3, as well as Scala.js and Scala Native. Version 3.2.20 was released on 26 March 2026.
The source code is at scalatest/scalatest on GitHub under the Apache-2.0 licence, with about 1,200 stars; the most recent commit was on 8 November 2026.
Features
- Many styles: FunSuite, FlatSpec, WordSpec, FreeSpec and more.
- Matchers DSL: Readable
shouldmatchers. - Async testing: Future-based test styles.
- Cross-platform: Scala JVM, Scala.js and Scala Native.
Pros
- Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 8 November 2026.
Cons
- Style choice overhead: Teams must agree on a style.
- Compile time: Large matcher DSL usage can slow compilation.
Usage and Links (Example)
// build.sbt
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.20" % Test
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
class PricingSuite extends AnyFunSuite with Matchers {
test("applies discount") {
Pricing.apply(100, 10) shouldBe 90
}
test("rejects negative prices") {
an[IllegalArgumentException] should be thrownBy Pricing.apply(-1, 0)
}
}
sbt test
Resources:
Pricing
ScalaTest is free and open source under the Apache-2.0 licence.
Recommended for?
- Scala teams wanting a flexible, mature testing toolkit.
- Projects targeting Scala.js or Scala Native.
Conclusion
ScalaTest is the most established Scala testing toolkit, flexible enough to suit almost any team’s style.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with ScalaTest side by side.
MMUnitMUnit is an Apache-2.0 Scala testing library from Scalameta with a minimal JUnit-based API, actionable error messages with diffs, fixtures and support for JVM, Scala.js and Scala Native.Compare with ScalaTest
Sspecs2specs2 is an MIT-licensed Scala library for writing executable software specifications, offering unit and acceptance specification styles, matchers and integration with ScalaCheck.Compare with ScalaTest
SScalaCheckScalaCheck is a BSD-3-Clause property-based testing library for Scala and Java, inspired by Haskell's QuickCheck, with generators, shrinking and stateful testing, used by ScalaTest, specs2 and MUnit.Compare with ScalaTest
JJUnit 5JUnit 5 is the current JUnit for Java and the JVM: Jupiter for new tests, Platform to launch them, Vintage to run JUnit 4.Compare with ScalaTest
MMockitoMockito is the MIT-licensed, most popular mocking framework for Java, used to create mocks, stubs and spies with a clean API; Mockito 5 uses the inline mock maker by default and requires Java 11.Compare with ScalaTest
KKotestKotest is an Apache-2.0 Kotlin multiplatform test framework with multiple testing styles, a large assertions library and built-in property-based testing.Compare with ScalaTest