maiflai / gradle-scalatest

A plugin to enable the use of scalatest in a gradle Scala project.
The Unlicense
73 stars 35 forks source link

ScalaTest 3.0.x support? #75

Closed SamNelson closed 5 years ago

SamNelson commented 5 years ago

Is it possible to get a build that supports ScalaTest 3.0.x?

maiflai commented 5 years ago

I think it already supports 3.0.x - is there a particular feature you're looking for please?

SamNelson commented 5 years ago

It may just be Async testing. Given the following test, I would expect it to fail:

package com.climate.fieldactivities.handler
import org.scalatest.AsyncFunSuite
import scala.concurrent.Future

class AsyncTest extends AsyncFunSuite {

  def gimmeFoo(): Future[String] = Future { "foo" }

  test("it should be 'foo'") {
    val futureFoo: Future[String] = gimmeFoo
    futureFoo map {foo =>
      assert(foo == "bar")
    }
  }
}

When I run ./gradlew test, no tests are executed.

./gradlew test

> Task :test
Discovery starting.
Discovery completed in 36 milliseconds.
Run starting. Expected test count is: 0
DiscoverySuite:
Run completed in 96 milliseconds.
Total number of tests run: 0
Suites: completed 1, aborted 0
Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
No tests were executed.
maiflai commented 5 years ago

Sorry, I don't seem to be able to reproduce this on macOS:

Please could you share the whole repository (or maybe a build.gradle)?

Task :test FAILED Discovery starting. Discovery completed in 103 milliseconds. Run starting. Expected test count is: 1 AsyncTest:

  • it should be 'foo' FAILED (69 milliseconds)
SamNelson commented 5 years ago

I found my problem. Thanks for the support.

maiflai commented 5 years ago

What was the problem please (just for my reference)?

phongngtuan commented 3 years ago

@SamNelson I might have got the same issue. Do you mind sharing the root cause of yours?

phongngtuan commented 3 years ago

seems like mine was caused by mixing IdiomaticMockito trait. Removing that solved my problem and the test is picked up by both intellij and gradle

maiflai commented 3 years ago

I think that Sam had referenced a deprecated scalatest trait, and removed it. I'm not sure which one it was.

Glad you're both up and running.