scalatest

Unknown artifact sbtplugin Super safe compiler with scala 2.12

十年热恋 提交于 2020-01-24 05:47:14
问题 In my sbt project in Scala 2.12 I am using IntelliJ IDEA and want to import scalatest. In order to install the recommended SuperSafe Community Edition Scala compiler plugin . I followed the instruction here. My plugin.sbt : addSbtPlugin("com.artima.supersafe" % "sbtplugin" % "1.1.2") the error showed by the Intellij import is: SBT project import [warn] [FAILED ] com.artima.supersafe#sbtplugin;1.1.2!sbtplugin.jar(src): (0ms) [warn] ==== typesafe-ivy-releases: tried [warn] https://repo.typesafe

Unable to run Unit tests (scalatest) on Spark-2.2.0 - Scala-2.11.8

不打扰是莪最后的温柔 提交于 2020-01-24 00:51:14
问题 Unable to run run scalatest with context on spark-2.2.0 StackTrace: An exception or error caused a run to abort: org.apache.spark.sql.test.SharedSQLContext.eventually(Lorg/scalatest/concurrent/PatienceConfiguration$Timeout;Lscala/Function0;Lorg/scalatest/concurrent/AbstractPatienceConfiguration$PatienceConfig;)Ljava/lang/Object; java.lang.NoSuchMethodError: org.apache.spark.sql.test.SharedSQLContext.eventually(Lorg/scalatest/concurrent/PatienceConfiguration$Timeout;Lscala/Function0;Lorg

Unable to run Unit tests (scalatest) on Spark-2.2.0 - Scala-2.11.8

我的梦境 提交于 2020-01-24 00:51:06
问题 Unable to run run scalatest with context on spark-2.2.0 StackTrace: An exception or error caused a run to abort: org.apache.spark.sql.test.SharedSQLContext.eventually(Lorg/scalatest/concurrent/PatienceConfiguration$Timeout;Lscala/Function0;Lorg/scalatest/concurrent/AbstractPatienceConfiguration$PatienceConfig;)Ljava/lang/Object; java.lang.NoSuchMethodError: org.apache.spark.sql.test.SharedSQLContext.eventually(Lorg/scalatest/concurrent/PatienceConfiguration$Timeout;Lscala/Function0;Lorg

ScalaTest in Eclipse: Running it gives NullPointer Exception

旧城冷巷雨未停 提交于 2020-01-23 03:49:06
问题 EDIT: This issue was a bug with sbteclipse and has been fixed When I right click on a ScalaTest suite and select Run as ScalaTest File, I get a NullPointer Exception. As a plugin, I have ScalaTest for Scala IDE 2.9.3.v-3-2_09-201309130843-55f5c32 As a jar in my library, I have scalatest_2.9.0-2.0.M5b.jar(tried scalatest_2.9.3-RC2-2.0.M5b.jar as well) Tests run in SBT Side Question: If it is a Scalatest compatibility issue between the jar and the plugin, how do I get the appropriate jar which

how to dermine if a test failed in afterEach of a FunSpec in scalatest

拟墨画扇 提交于 2020-01-21 10:08:26
问题 In scalatest using FunSpec I have some code that fires in the afterEach. I would like to execute some code to get a screenshot only when the test fails. Just about everything I have looked at tries to solve this by putting asserts in try blocks which seems awful. Is there anything like onTestFailure in TestNG or a context I can get like RSpec to determine if the test failed? Looking at the scala doc I see a implementation that takes a configMap, but that is empty when I run the test. Any help

How to test that Akka actor was created in Scala

依然范特西╮ 提交于 2020-01-21 03:03:05
问题 I'm trying to write a test that will verify that my actor below is creating a heartBeatExpireWorker and a heartBeatAccepter, but I have no idea how to do it. First I was thinking I could use Mockhito mock or a spy in place of context and then verify that I called actorOf, but I can't figure out a way to inject the context without breaking the Akka testing framework. Then, I was thinking that I could send an Identify message to the workers to verify that they exist. But it occurred to me that

How to chain function arguments in Scala?

大兔子大兔子 提交于 2020-01-17 05:20:07
问题 I'd like to define my tests using the following function (ignore some dependencies for now e.g. fixture1 etc they are at the bottom): multiTest("my test name", fixture1) { case (x: Double, y: Int, z: String) => // test body } and multiTest is defined in my base custom FunSpecLike subclass as: def multiTest(testName: String, fixture: FixtureTable)(fun: => Unit)(implicit pos: source.Position): Unit = { val heading = fixture.heading fixture.values.foreach { tuple => it(autoGenerateDesc(heading,

Using a mocked object as an implicit in scala using scalamock

孤街浪徒 提交于 2020-01-16 04:04:31
问题 I am using a trait definition with various concrete derivatives and implicit to inject dependancies into objects and also to mock out parts of the system when unit testing. The problem is that when a mocked version of a type is used as an implicit declaration, it is not matched by scala in the consuming object. Here is a simplified version of my setup. Is there a way to make Test1 work using a mock. Test2 works fine but it hard to maintain and requires too much setup. A model: case class User

Using a mocked object as an implicit in scala using scalamock

爷,独闯天下 提交于 2020-01-16 04:03:06
问题 I am using a trait definition with various concrete derivatives and implicit to inject dependancies into objects and also to mock out parts of the system when unit testing. The problem is that when a mocked version of a type is used as an implicit declaration, it is not matched by scala in the consuming object. Here is a simplified version of my setup. Is there a way to make Test1 work using a mock. Test2 works fine but it hard to maintain and requires too much setup. A model: case class User

Setting up multiple test folders in a SBT project

蹲街弑〆低调 提交于 2020-01-14 07:45:09
问题 We'd like to set up our SBT project so that we have multiple test folders as opposed to one. So we'd like to see: root src test scala unit functional How would we configure our SBT project file paths to do this? 回答1: SBT 0.9.x: (sourceDirectories in Test) := Seq(new File("src/test/scala/unit"), new File("src/test/scala/functional")) SBT 0.7.x : override def testSourceRoots = ("src" / "test") +++ "scala" +++ ("unit" / "functional") 来源: https://stackoverflow.com/questions/6212540/setting-up