Skip to content

[Question] OneBrowserPerSuite: How to prevent browser startup when skipping tests using this trait? #100

@el-dom

Description

@el-dom

I'm in a scenario where unittests and fluentlenium integration tests are placed in the same module but need to be run seperately at different stages of deployment in different environments.

A Fluentlenium Spec might look like this

@IntegrationTest
class IntegrationSpec extends WordSpec with MustMatchers  with GuiceOneServerPerSuite with OneBrowserPerSuite {
 override def fakeApplication(): Application = FluentleniumSetup.app
 override def createWebDriver(): WebDriver = FluentleniumSetup.createWebDriver()
...
}

and a unit test like this

@UnitTest
class FooSpec extends WordSpec with MustMatchers with TypeCheckedTripleEquals {
...
}

To be able to seperate the test executions, this configuration in build.sbt was created:

lazy val ITest = config("i").extend(Test)
lazy val UTest = config("u").extend(Test)
testOptions in ITest += Tests.Argument(TestFrameworks.ScalaTest, "-l","foo.bar.UnitTest
testOptions in UTest += Tests.Argument(TestFrameworks.ScalaTest, "-l","foo.bar.IntegrationTest")

This way i can run sbt u:test and all suits annotated with @IntegrationTest will be skipped due to the exclude flag -l.
But still, whenever test execution reaches a Test annotated with IntegrationSpec, a browser gets started and closes immediately without doing anything, because all tests in this Suite get skipped. Since there is no browser installed in the environment where u:test is meant to be executed, this attempt to start a browser breaks test execution. Which is unfortunate because it wouldn't be necessary to start a browser at all. Am i doing something wrong in my attempt to skip the Testsuits?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions