Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run specific tests using SBT Jenkins Plugin for ScalaTest test

Currently we are using IntelliJ, Scala, SBT to kick off our tests in our local enviroment. With SBT command line, we can specify specific test, suites, wildcards, as instructed here:

ScalaTest.org Page

Such as "test-only *RedSuite"

However on our CI Jenkins server, with the SBT pluging, when specifying this, it gives an error.

In the action field, the following values were used:

Action:compile test-only test.package.name

Using the following does work for ALL tests:

Action:compile test

[success] Total time: 240 s, completed Apr 28, 2014 12:29:36 PM
[error] Expected ID character
[error] Not a valid command: org (similar: export)
[error] Expected project ID
[error] Expected configuration
[error] Expected ':' (if selecting a configuration)
[error] Expected key
[error] Not a valid key: org (similar: fork, run, doc)
[error] org.company.scalatest.abc.regressionsuite
[error]    ^
Build step 'Build using sbt' changed build result to FAILURE
Build step 'Build using sbt' marked build as failure
Recording test results

Does anyone know if there is a way we can pass these parameters through the jenkins SBT plugin?

like image 348
user1697841 Avatar asked Apr 28 '14 17:04

user1697841


People also ask

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.

Does sbt run tests in parallel?

By default, sbt executes tasks in parallel (subject to the ordering constraints already described) in an effort to utilize all available processors. Also by default, each test class is mapped to its own task to enable executing tests in parallel.


1 Answers

This is a quoting problem, your Action field is parsed as 3 commands:

  • compile
  • test-only
  • org.company.scalatest.abc.regressionsuite

And it chokes because that org is not a valid command.

Using compile "test-only org.company.scalatest.abc.regressionsuite" should fix that.

like image 154
gourlaysama Avatar answered Sep 17 '22 16:09

gourlaysama