java -cp "lib/*" org.scalatest.tools.Runner -w "com.company" -eDF -R lib/my_tests.jar
it works as expected, but ./scalatest-native -w "com.company" -eDF -R lib/my_tests.jar
returns No tests were executed.
. Am I missing something obvious? Adding -s com.company.MySuite
fails with a ClassNotFoundException
so it looks like the native version isn't even looking into my_tests.jar? At this point I am not sure yet if I did something wrong with the native image generation or if I don't use scalatest's runner properly, possibly both :)
[error] |bad parameter reference Function.this.R at inlining
[error] |the parameter is type R in trait Function but the prefix (Function.this : Function[V, R])
[error] |does not define any corresponding arguments.
[error] |idx = 1, args = List()
https://github.com/objektwerks/scala3
List(1, 2, 2, 3, 3, 3) should be (List(3, 2, 3, 1, 2, 3, 5))
<Click to see difference>
in Intellij which is nice.<Click to see difference>
List(1, 2, 2, 3, 3, 3) should contain theSameElementsAs List(3, 2, 3, 1, 2, 3, 5)
java.lang.NoSuchMethodError: 'void org.scalactic.TripleEqualsSupport.$init$(org.scalactic.TripleEqualsSupport)'
I am using scalatest/scalactic 3.2.9 building with mill. Any help is appreciated.
Hi, I upgraded to scalatest 3.2.9 from 3.0.9 and I get this compilation error:
type mismatch;
found : ResultOfATypeInvocation[ScriptResult.ScriptResultFailure] (in org.scalatest.words)
required: ResultOfATypeInvocation[_] (in org.scalatest.matchers.dsl)
result.failed.get shouldBe a[ScriptResultFailure]
but in the doc I read its supported the syntax smthg shouldBe a [Double]
where am I wrong?
@jorgeadriano fyi i have uploaded an example project for supersafe here: https://github.com/scalatest/supersafe-sbt-example
Thank you @cheeseng!
Scala-2.12
and scalatest 3.0
fixture.AsyncWordSpec
which works properly. The problem comes when I try to change the default execution context (which is a serial execution context provided by ScalaTest
) by the global (scala.concurrent.ExecutionContext.Implicits.global
). The suite is completed almost immediately with 0 tests completed. is there anything additional that needs to be done so that inner futures can run in a multi-threading execution context like the global one?
@RunWith(classOf[JUnitRunner])
class TestWithFuturesSpec
extends fixture.AsyncWordSpec
with Matchers
with Inside
with EitherValues
with Eventually
with MockitoSugar {
case class FixtureInstance(param: Int)
implicit override def executionContext: ExecutionContext = scala.concurrent.ExecutionContext.Implicits.global
type FixtureParam = FixtureInstance
override def withFixture(test: OneArgAsyncTest): FutureOutcome = {
withFixture(test.toNoArgAsyncTest(FixtureInstance(param = 1)))
}
def operate(value: Int): Int = ???
def otherOperate(value1: Int, value2: Int): Future[Int] = ???
"test 1" should {
"run properly" when {
"called" in { f =>
val f1: Future[Int] = Future(operate(f.param)) // expensive operation
val f2: Future[Int] = Future(operate(f.param)) // expensive operation
for {
r1 <- f1
r2 <- f2
r3 <- otherOperate(r1, r2)
} yield {
r3 shouldBe 9999
}
}
}
}
}
[scalatest] Reporter completed abruptly with an exception after receiving event: SuiteCompleted(Ordinal(1, 10),TestSpec,xxxx.TestSpec,Some(xxxx.TestSpec),Some(11102),Some(MotionToSuppress),Some(TopOfClass(xxxx.TestSpec)),Some(xxxx.TestSpec),None,ScalaTest-main-running-DiscoverySuite,1624467770938).
[scalatest] java.lang.RuntimeException: unexpected event [SuiteCompleted(Ordinal(1, 10),TestSpec,xxxx.TestSpec,Some(xxxx.TestSpec),Some(11102),Some(MotionToSuppress),Some(TopOfClass(xxxx.TestSpec)),Some(xxxx.TestSpec),None,ScalaTest-main-running-DiscoverySuite,1624467770938)]
[scalatest] at org.scalatest.tools.JUnitXmlReporter.unexpected(JUnitXmlReporter.scala:494)
[scalatest] at org.scalatest.tools.JUnitXmlReporter.processTest(JUnitXmlReporter.scala:324)
[scalatest] at org.scalatest.tools.JUnitXmlReporter.getTestsuite(JUnitXmlReporter.scala:166)
[scalatest] at org.scalatest.tools.JUnitXmlReporter.writeSuiteFile(JUnitXmlReporter.scala:76)
[scalatest] at org.scalatest.tools.JUnitXmlReporter.apply(JUnitXmlReporter.scala:59)
[scalatest] at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10(DispatchReporter.scala:249)
[scalatest] at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10$adapted(DispatchReporter.scala:248)
[scalatest] at org.scalatest.DispatchReporter$Propagator$$Lambda$2041/0x0000000000000000.apply(Unknown Source)
[scalatest] at scala.collection.immutable.List.foreach(List.scala:431)
[scalatest] at org.scalatest.DispatchReporter$Propagator.run(DispatchReporter.scala:248)
[scalatest] at java.lang.Thread.run(Thread.java:823)