scalatest run integration test separately from unit test

538 views Asked by At

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

1

There are 1 answers

1
Gorka On

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.