scalatest / scalatest-maven-plugin

ScalaTest Maven Plugin
Apache License 2.0
34 stars 61 forks source link

Guice Configuration Errors when running tests #50

Open tenstriker opened 6 years ago

tenstriker commented 6 years ago

I have few test classes defined in my maven-play2 project setup. All tests run fine from ScalaIDE when running as ScalaTest Suite/File/Package. But when I try to run it via maven command line it fails. It also ignores @Ignore decoration on test class and still runs it.

Here's the stacktrace Cause: com.google.inject.ConfigurationException: Guice configuration errors:

1) No implementation for com.mycomp.myproj.kap.KapDaoClient was bound. while locating com.mycomp.myproj.kap.KapDaoClient for the 1st parameter of com.mycomp.myproj.kap.KapServices

1 error at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1045) at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004) at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1054) at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:409) at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:404) at play.api.inject.ContextClassLoaderInjector$$anonfun$instanceOf$2.apply(Injector.scala:117) at play.api.inject.ContextClassLoaderInjector.withContext(Injector.scala:126) at play.api.inject.ContextClassLoaderInjector.instanceOf(Injector.scala:117) at com.mycomp.myproj.tests.functional.MetadataServiceSpec.(MetadataServiceSpec.scala:20) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ... Run completed in 4 seconds, 585 milliseconds. Total number of tests run: 4 Suites: completed 2, aborted 4 Tests: succeeded 2, failed 2, canceled 0, ignored 0, pending 0 4 SUITES ABORTED 2 TESTS FAILED

Plugin Configuration

        <plugin>
          <groupId>org.scalatest</groupId>
          <artifactId>scalatest-maven-plugin</artifactId>
          <version>2.0.0</version>
          <configuration>
            <reportsDirectory>${project.build.directory}/target/surefire-reports</reportsDirectory>
            <junitxml>.</junitxml>
            <filereports>WDF_TestSuite.txt</filereports>
            <parallel>false</parallel>
            <forkMode>never</forkMode>
          </configuration>
          <executions>
            <execution>
              <id>test</id>
              <goals>
                <goal>test</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
tenstriker commented 6 years ago

Looks like never caused an issue. It may be have to do with GuiceOneAppPerSuite class. If that's the case then that plugin option should be re-evaluated or be ignored if forkCount=0