ScalaTest User Guide Getting started Selecting testing styles Defining base classes Writing your first test Using assertions Tagging your tests Running your tests Sharing fixtures Sharing tests Using matchers Testing with mock objects Property-based testing Asynchronous testing Using Scala-js Using Inside Using OptionValues Using EitherValues Using PartialFunctionValues Using PrivateMethodTester Using WrapWith Philosophy and design Migrating to 3.0 |
Using ScalaTest with EclipseFor Eclipse users, ScalaTest offers a powerful plugin that provides seamless support for testing in the Scala IDE for Eclipse. Not only does this plugin give Scala programmers the level of test-framework/IDE integration that Java programmers have enjoyed with JUnit, it goes quite a bit farther:
You can use the plugin with any release of ScalaTest, but you'll enjoy the most seamless IDE integration if you use ScalaTest 3.2.19. You can plug it into the latest stable release of the Scala IDE for Eclipse (version 3.0.x). For a nightly build, you'll need to build it by hand by following the steps given in https://github.com/scalatest/scalatest-eclipse-plugin Screenshot of ScalaTest Eclipse Plugin with ScalaTest 3.2.19Installing the ScalaTest Eclipse PluginYou can install the plugin together with Scala IDE using latest update sites listed at http://scala-ide.org/. For Scala IDE 3.0.x, tick 'ScalaTest for Scala IDE' as shown in the figure below: Information on the features of the integration (and some screenshots (and the source code)) is here: https://github.com/scalatest/scalatest-eclipse-plugin A video demo of the plugin that I gave back at ScalaDays is here: http://skillsmatter.com/podcast/scala/scalatest-scalamock-subcut Info on ScalaTest 3.2.19 is here: http://www.scalatest.org/download With the release notes for ScalaTest 3.2.19 here: http://www.scalatest.org/release_notes/2.0 Using ScalaTest in a Scala projectTo use ScalaTest in your Scala project, you must download ScalaTest and include it in build path of your project. You can use any ScalaTest 1.x release or the latest 3.2.19 (recommended). Using ScalaTest 2.0 enables the following:
When using ScalaTest 1.x, the GUI Runner provided by ScalaTest will be used instead of the built-in test result view.
Running a Selected SuiteTo run a selected suite, you can select the suite using 2 different ways:-
After you choose the target suite element, just right click and choose:- Run As -> ScalaTest - Suite A Run Configuration with the suite name will be created automatically. Running a Selected TestTo run a selected test, click on the target test element in the editor, right click and choose:- Run As -> ScalaTest - Test A Run Configuration with the test name will be created automatically. Running a Selected ScopeTo run a selected scope, click on the target scope element in the editor, right click and choose:- Run As -> ScalaTest - Test A Run Configuration with the scope name will be created automatically. Running All Suites in a Selected FileTo run all ScalaTest suites in a selected file, you can select the file using 2 different ways:
After you choose the target Scala source file, just right click and choose:- Run As -> ScalaTest - File All ScalaTest suites in the selected Scala source file will be run. A Run Configuration with the file name will be created automatically. Running All Suites in Selected PackageTo run all ScalaTests suites in a package, you can right click on a package in Project Explorer and choose:- Run As -> ScalaTest Package All ScalaTest suites in the selected package (not nested package) will be run. To include ScalaTest suites in nested packages, you'll need to select the 'Include Nested' option in the Run Configuration. A Run Configuration with the package name will be created automatically. Run Configuration Types
|
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-2025 Artima, Inc. All Rights Reserved.