Installing ScalaTest

ScalaTest and Scalactic 3.2.18 (the latest release for Scala 2.10.0+, 2.11.0+, 2.12.0+, 2.13.0+, and 3.1.0+)

The ScalaTest 3.2.18 artifacts and Scalactic 3.2.18 artifacts are available via the Sonatype OSS Maven repository and mirrored on Maven central.


To include ScalaTest 3.2.18 in your sbt project:

1. Add these lines to your build file:

libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.18"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % "test"
If you're using 3.x version and scala-js, you should use %%% instead in your project:
libraryDependencies += "org.scalactic" %%% "scalactic" % "3.2.18"
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.18" % "test"

The dependency on Scalactic, ScalaTest's sister library focused on quality through types, is recommended but not required.

2. If you're using 3.x version, we also recommend you also include the SuperSafe Community Edition Scala compiler plugin for Scala 2.x (not supported for Scala 3.x), which will flag errors in your ScalaTest (and Scalactic) code at compile time, by first adding this line to ~/.sbt/1.0/global.sbt (or ~/.sbt/0.13/global.sbt if you're using SBT 0.13.x):

resolvers += "Artima Maven Repository" at "https://repo.artima.com/releases"

3. Then adding the following line to project/plugins.sbt:

addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.12")

You are off and running! As a next step, visit the Getting Started section of the user guide.


To include ScalaTest 3.2.18 in your Maven project:

1. Add the following dependencies to your pom.xml:

<dependency>
  <groupId>org.scalactic</groupId>
  <artifactId>scalactic_3</artifactId>
  <version>3.2.18</version>
</dependency>
<dependency>
  <groupId>org.scalatest</groupId>
  <artifactId>scalatest_3</artifactId>
  <version>3.2.18</version>
  <scope>test</scope>
</dependency>

The dependency on Scalactic, ScalaTest's sister library focused on quality through types, is recommended but not required.

2. If you're using ScalaTest 3.x version, we also recommend you also include the SuperSafe Community Edition Scala compiler plugin for Scala 2.x (not supported for Scala 3.x), which will flag errors in your ScalaTest (and Scalactic) code at compile time, by adding the following lines to your pom.xml:

<repositories>
    <repository>
        <id>artima</id>
        <name>Artima Maven Repository</name>
        <url>https://repo.artima.com/releases</url>
    </repository>
</repositories>
<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <configuration>
        <compilerPlugins>
            <compilerPlugin>
                <groupId>com.artima.supersafe</groupId>
                <artifactId>supersafe_3.3.1</artifactId>
                <version>1.1.12</version>
            </compilerPlugin>
        </compilerPlugins>
    </configuration>
    <executions>
        ...
    </executions>
</plugin>

Note: You need to use the exact Scala version in the artifactId, because compiler plugin depends on compiler API that's not binary compatible between Scala minor releases.

You are off and running! As a next step, visit the Getting Started section of the user guide.


If you don't have it already, you'll also need Scala. You can use any 2.10, 2.11, 2.12, 2.13 or 3.1 release, which you can get from here:


Older Releases of ScalaTest and Scalactic

For information on older releases, please visit the Older Releases page.

ScalaTest is brought to you by Bill Venners and Artima.
ScalaTest is free, open-source software released under the Apache 2.0 license.

If your company loves ScalaTest, please consider sponsoring the project.

Copyright © 2009-2024 Artima, Inc. All Rights Reserved.

artima