Domanda

I've been working on a Scala application. To do it properly, I want the kernel of my code to be completely covered by tests. To do that, I'm using the SCCT plugin for SBT.

Unfortunately, my tests rely on an in-memory database (h2). Therefore, my tests cannot run in parallel. However, sbt runs all tasks in parallel by default.

To solve this, I've modified build.sbt file to disable parallel execution of the tests as:

parallelExecution in Test := false

The problem with the build configuration is that to generate code coverage, I need to run sbt scct:test rather than sbt test.

I've tried to disable the parallel execution of scct:test but the code below does not compile:

parallelExecution in scct:test := false

Can anyone help me by either disabling the parallel execution in scct:test by either setting the flag, or by making scct:test run in the test context?

È stato utile?

Soluzione

I think the task name is actually ScctTest. Try:

parallelExecution in Test := false
parallelExecution in ScctTest := false

Altri suggerimenti

Have you considered creating a new database for each test and making the db name that is created be a random name for each one so they dont clash. Works well as long as you dont have absolutely massive numbers of tests which require a database.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top