Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run all scalatest of a multi-modules sbt with intellij?

I can run:

  1. a specific scala test
    • either by right clicking on the test and choose run
    • or if I have run it once previously, by selecting the test in run menu > run...
  2. I can run all junit tests by making a new run/debug configuration > + > junit > test kind = all in package > search for tests = in whole project
  3. I can run all scalatest (or junit) of one sub-project: right click on the project > run > scalatest in [module name]

But if I do the same as (2) with a scala test (+ > scala test > test kind...) the first test fails very strangely (it seems an object is not instantiated) while the same test pass if I run it using (1) or (3)

Config:

  • sbt with multiple subproject
  • intellij CE 15.0.2
  • scala plugin 2.1.0
  • scala 2.10

Bonus question: how to run all tests (junit and scalatest)?

like image 950
Juh_ Avatar asked Feb 20 '16 12:02

Juh_


People also ask

How do I run ScalaTest in IntelliJ?

Open the test in the editor, press Ctrl+Shift+F10 or right-click on the test class and from the context menu select Run 'test name'. IntelliJ IDEA creates a run/debug configuration for the test automatically, but if you want to edit settings in your configuration, click Run | Edit Configurations on the main menu.

How do I run an sbt Assembly in IntelliJ?

IntelliJ now allows you to create a run configuration for an SBT task. You create the Run Configuration by : choosing "Edit configurations" from the "Run" menu (or the toolbar popup) click the "+" button to add a configuration and select "SBT Task" as the type of configuration you want to make.

What is ScalaTest sbt?

ScalaTest is one of the main testing libraries for Scala projects, and in this lesson you'll see how to create a Scala project that uses ScalaTest. You'll also be able to compile, test, and run the project with sbt.

How do I import an existing sbt project into IntelliJ?

After you have an sbt build – one you created yourself or from a template – follow these steps to import the project into IntelliJ IDEA: From the Welcome Screen or File menu, select Open. Browse to and select the top-level folder of your sbt project, and click OK. The Import Project from SBT dialog opens.

How do I run a Scala test in SBT?

Add your Scala source code under the src/main/scala folder, add your tests under the src/test/scala folder, and then run the tests with the SBT test command:

How to use SBT in IntelliJ IDEA?

IntelliJ IDEA displays results in the sbt shell window. Use the sbt settings to configure the build and run actions the sbt project, an sbt version, importing of the project's changes, and so on. Press Ctrl+Alt+S to open the IDE settings and select Build, Execution, Deployment| sbt.

How do I run Scalatest in IntelliJ?

ScalaTest support in the IntelliJ Scala plugin The IntelliJ Scala plugin comes with good ScalaTest support, including: Running ScalaTest suite by right-clicking on the source Showing the run results in a format that mirrors the structure of the suite/specification

How to find thread pool size of Scala test in SBT?

ScalaTest uses its own thread pool to run ParallelTestExecution suites, its pool size is determined by the following formula: To see classpath that sbt uses to lookup for test classes, you can use the following command: You can pass arguments to ScalaTest by using testOptions and Tests.Argument in your sbt build file:


1 Answers

You should be able to right click on the root directory of the project and click Run "All Tests". This recursively searches for tests in your project, and will run the tests in each module.

like image 199
Regan Koopmans Avatar answered Sep 22 '22 21:09

Regan Koopmans