CINXE.COM

ScalaTest

<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>ScalaTest</title> <link rel="Stylesheet" href="/assets/stylesheets/main.css" type="text/css" media="screen"/> <link rel="stylesheet" type="text/css" href="/assets/stylesheets/print.css" media="print" /> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-NJWCS90VG5"></script> <script defer src='/assets/javascripts/gtag.js'></script> </head> <body> <div class="Container"> <!-- Top of scalatest.org 660 x 60 [async] --> <script id="adsArtimaScript" type="text/javascript" src="https://www.artima.com/assets/javascripts/4ca150665e51d0b1c3890ca1b891c507-ads.js?product=ScalaTest"></script> <div id="Header"> <div id="Nav"> <a href="/">Home</a> | <a href="/quick_start">Quick Start</a> | <span><em>Install</em></span> | <a href="/user_guide">User Guide</a> | <a href="/at_a_glance">At A Glance</a> | <a href="/scaladoc">Scaladoc</a> | <a href="/supersafe">SuperSafe</a> | <a href="/plus">Plus</a> | <!-- <a href="/videos">Videos</a> | --> <!-- Temporarily removed per Bill request 171114 PL --> <a href="/donate">Donate</a> | <a href="/about">About</a> </div> <!-- Nav --> </div> <!-- Header --> <div id="body"> <div class="message"> <a class="scalatestLogo" href="./"> <img src="/assets/images/scalaTestLogo.gif" width="400" height="60" alt="ScalaTest"/> </a> </div> <div style="text-align: left"> <h1>Installing ScalaTest</h1> <p> <strong>ScalaTest and Scalactic 3.2.19</strong> (the latest release for Scala 2.10.0+, 2.11.0+, 2.12.0+, 2.13.0+, and 3.1.0+) <ul> <li><a href="/release_notes/3.2.19">Combined 3.2.19 Release Notes</a></li> <li><a href='/scaladoc/3.2.19/org/scalatest/flatspec/AnyFlatSpec.html'>ScalaTest 3.2.19 Scaladoc</a></li> <li><a href="https://www.scalactic.org/scaladoc/3.2.19/index.html">Scalactic 3.2.19 Scaladoc</a></li> </ul> <p> The <a href="https://oss.sonatype.org/content/groups/public/org/scalatest/scalatest_3/3.2.19/">ScalaTest 3.2.19 artifacts</a> and <a href="https://oss.sonatype.org/content/groups/public/org/scalactic/scalactic_3/3.2.19/">Scalactic 3.2.19 artifacts</a> are available via the Sonatype OSS Maven repository and mirrored on Maven central. </p> <hr /> <!-- ############################################### --> <p> <em>To include ScalaTest 3.2.19 in your <a href="https://www.scala-sbt.org"><strong>sbt</strong></a> project:</em> </p> <p> 1. Add these lines to your build file: </p> <pre class="stHighlighted"> libraryDependencies += <span class="stQuotedString">"org.scalactic"</span> %% <span class="stQuotedString">"scalactic"</span> % <span class="stQuotedString">"3.2.19"</span> libraryDependencies += <span class="stQuotedString">"org.scalatest"</span> %% <span class="stQuotedString">"scalatest"</span> % <span class="stQuotedString">"3.2.19"</span> % <span class="stQuotedString">"test"</span> </pre> If you're using 3.x version and scala-js, you should use <code>%%%</code> instead in your project: <pre class="stHighlighted"> libraryDependencies += <span class="stQuotedString">"org.scalactic"</span> %%% <span class="stQuotedString">"scalactic"</span> % <span class="stQuotedString">"3.2.19"</span> libraryDependencies += <span class="stQuotedString">"org.scalatest"</span> %%% <span class="stQuotedString">"scalatest"</span> % <span class="stQuotedString">"3.2.19"</span> % <span class="stQuotedString">"test"</span> </pre> <p> The dependency on <a href="https://www.scalactic.org">Scalactic</a>, ScalaTest's sister library focused on quality through types, is recommended but not required. </p> <p> 2. If you're using 3.x version, we also recommend you also include the <a href="/supersafe">SuperSafe Community Edition</a> 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 <code>~/.sbt/1.0/global.sbt</code> (or <code>~/.sbt/0.13/global.sbt</code> if you're using SBT 0.13.x): </p> <pre class="stHighlighted"> resolvers += <span class="stQuotedString">"Artima Maven Repository"</span> at <span class="stQuotedString">"https://repo.artima.com/releases"</span> </pre> <p> 3. Then adding the following line to <code>project/plugins.sbt</code>: </p> <pre class="stHighlighted"> addSbtPlugin(<span class="stQuotedString">"com.artima.supersafe"</span> % <span class="stQuotedString">"sbtplugin"</span> % <span class="stQuotedString">"1.1.12"</span>) </pre> <p> You are off and running! As a next step, visit the <a href="/user_guide">Getting Started</a> section of the user guide. </p> <hr /> <!-- ############################################### --> <p> <em>To include ScalaTest 3.2.19 in your <strong>Maven</strong> project</em>: </p> <p> 1. Add the following dependencies to your <code>pom.xml</code>: </p> <pre class="stHighlighted"> &lt;dependency&gt; &lt;groupId&gt;org.scalactic&lt;/groupId&gt; &lt;artifactId&gt;scalactic_3&lt;/artifactId&gt; &lt;version&gt;3.2.19&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.scalatest&lt;/groupId&gt; &lt;artifactId&gt;scalatest_3&lt;/artifactId&gt; &lt;version&gt;3.2.19&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; </pre> <p> The dependency on <a href="https://www.scalactic.org">Scalactic</a>, ScalaTest's sister library focused on quality through types, is recommended but not required. </p> <p> 2. If you're using ScalaTest 3.x version, we also recommend you also include the <a href="/supersafe">SuperSafe Community Edition</a> 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 <code>pom.xml</code>: </p> <pre class="stHighlighted"> &lt;repositories&gt; &lt;repository&gt; &lt;id&gt;artima&lt;/id&gt; &lt;name&gt;Artima Maven Repository&lt;/name&gt; &lt;url&gt;https://repo.artima.com/releases&lt;/url&gt; &lt;/repository&gt; &lt;/repositories&gt; &lt;plugin&gt; &lt;groupId&gt;net.alchim31.maven&lt;/groupId&gt; &lt;artifactId&gt;scala-maven-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;compilerPlugins&gt; &lt;compilerPlugin&gt; &lt;groupId&gt;com.artima.supersafe&lt;/groupId&gt; &lt;artifactId&gt;supersafe_2.13.14&lt;/artifactId&gt; &lt;version&gt;1.1.12&lt;/version&gt; &lt;/compilerPlugin&gt; &lt;/compilerPlugins&gt; &lt;/configuration&gt; &lt;executions&gt; ... &lt;/executions&gt; &lt;/plugin&gt; </pre> <p> <em>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.</em> </p> <p> You are off and running! As a next step, visit the <a href="/user_guide">Getting Started</a> section of the user guide. </p> <hr /> <!-- ############################################### --> <p> 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: </p> <ul> <li><a href="https://www.scala-lang.org/downloads">Download the latest Scala release</a></li> </ul> <!-- <a name="latestMilestone"></a> --> <hr style="height:5px;border:none;color:#333;background-color:#333;" /> <!-- ############################################### --> <strong>Older Releases of ScalaTest and Scalactic</strong> <p>For information on older releases, please visit the <a href="/older_releases">Older Releases</a> page.</p> </div> </div> <!-- body --> <div style="font-size: 66%; margin-top: 60px"> <p> ScalaTest is brought to you by Bill Venners and Artima.<br /> ScalaTest is free, open-source software released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2.0 license</a>. </p> <p> If your company loves ScalaTest, please consider <a href="/sponsor">sponsoring the project</a>. </p> <p> Copyright &copy; 2009-2025 Artima, Inc. All Rights Reserved. </p> <p> <a href="http://www.artima.com" class="no_link_hover"> <img src="/assets/images/artima100Black.png" style="margin-top: 2px" width="100" height="38" alt="artima"/> </a> </p> </div> <!-- style="..." --> </div> <!-- Container --> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10