2

I am using scalatest maven plugin and I would like to run integration test separately from unit tests. The tests path are src/it and src/test for integration test and unit test respectively.

Which is the best approach to achieve this goal?

Thanks

Gorka
  • 377
  • 3
  • 14

1 Answers1

0

One option is to create an object and then use it as a tag in each test:

object IntegrationTag extends Tag("Integration-Test")

test("Test for correct number of records", IntegrationTag) {
    // some stuff
}

Then, if you want to test the Unit Tests simply run the command:

mvn test -DtagsToExclude=Integration-Test

This is a possible solution...sure that will be more.

Gorka
  • 377
  • 3
  • 14
  • By that if you are also implying that one should use the similar command to run the integration tests - then those would not be run in the verify phase (where the integration tests should actually run). – Karttik Mishra Jul 21 '20 at 05:17