scalatest

How to configure sbt test / ScalaTest to only show failures?

倾然丶 夕夏残阳落幕 提交于 2019-12-20 11:34:11
问题 Is there a way to truncate the test results to only show result text for unit tests only when the unit test has failed? I'm working on a Scala project that has 850 unit tests, and the green text from the successful unit tests makes it difficult to focus on just the failures. Example of what I'm talking about: [info] - should have colors [info] - should not be dead //.... x 100 [info] - animals should not be rainbows *** FAILED *** [info] -"[rainbow]s" was not equal to "[ponie]s"

How to disable “Slow” tagged Scalatests by default, allow execution with option?

帅比萌擦擦* 提交于 2019-12-20 09:59:17
问题 I want to disable certain automated tests tagged as "Slow" by default but allow the user to enable their execution with a simple command line. I imagine this is a very common use case. Given this test suite: import org.scalatest.FunSuite import org.scalatest.tagobjects.Slow class DemoTestSuite extends FunSuite { test("demo test tagged as slow", Slow) { assert(1 + 1 === 2) } test("demo untagged test") { assert(1 + 1 === 2) } } By default, sbt test will run both tagged and untagged tests. If I

How can I get complete stacktraces for exceptions thrown in tests when using sbt and testng?

佐手、 提交于 2019-12-20 08:35:04
问题 The stacktraces are truncated - e.g. they end with [info] ... Using last or changing traceLevel doesn't help - it simply prints the complete stacktrace of the sbt wrapper. This is testing with testng (also I believe using scalatest and sl4j) 回答1: Using hints found in the documentation here: (quoted) You can configure the output shown when running with sbt in four ways: 1) turn off color, 2) show short stack traces, 3) full stack traces, and 4) show durations for everything. To do so you must

What’s the difference between ScalaTest and Scala Specs unit test frameworks?

筅森魡賤 提交于 2019-12-20 07:58:32
问题 Both are BDD (Behavior Driven Development) capable unit test frameworks for Scala written in Scala. And Specs is built upon may also involve the ScalaTest framework. But what does Specs offer ScalaTest doesn't? What are the differences? 回答1: Specs and ScalaTest are both good tools with happy users, but they differ in several ways. You will probably want to pick one as your main testing tool in Scala, but need not give up the other because you can use pieces of both. If you like ScalaTest's

Scalatest PlusPlay Selenium not able to resize a window

梦想的初衷 提交于 2019-12-20 06:06:25
问题 Been digging at this for a while, and I can't seem to find a way to resize a window using scalatest plus. The only method I've found searching online or the documentation at http://doc.scalatest.org/2.1.5/index.html#org.scalatest.selenium.WebBrowser is executeScript("window.resizeTo(700,700);") but that has been unresponsive to me (no errors, no nothing). Is there a method that covers this that I am missing? A brief sample of my code: import java.util.concurrent.TimeUnit import org

How to cut a long ScalaTest spec to pieces

*爱你&永不变心* 提交于 2019-12-20 04:48:27
问题 I'm testing a REST API, and the code goes like this: Setting up stuff, populating a database using PUSH calls Testing API a Testing API b ... The code is currently in one rather huge FlatSpec : class RestAPITest extends FlatSpec with Matchers with ScalatestRouteTest with SprayJsonSupport I would like to chop the "Testing API a/b/..." parts out, to have the code more manageable. Trying to do that seems like a no-no: what's the type of it - how to pass that on, etc. etc. So, what's the

ScalaTest on sbt not running any tests

北战南征 提交于 2019-12-19 17:40:47
问题 I am trying to run my tests with: sbt and then test. My build.sbt looks like this lazy val scalatest = "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test" lazy val root = (project in file(".")). settings( name := "highlight2pdf", version := "0.1", scalaVersion := "2.11.6", libraryDependencies += scalatest ) And i just put the example test on test/scala import collection.mutable.Stack import org.scalatest._ class ExampleSpec extends FlatSpec with Matchers { "A Stack" should "pop values in

Why does scalatest mix up the output?

一个人想着一个人 提交于 2019-12-19 12:38:41
问题 I run my scalatest from sbt, and the output gets mixed up - scalatest prints all the test run, and comments to them, and somewhere in the middle it prints the statistics: > test [info] Compiling 1 Scala source to /home/platon/Tor/scala-dojo-02/target/scala-2.9.1/classes... [info] FunsWithListsTests: [info] - should return list of labels [info] - should return the average rating of games belonging to Zenga [info] - should return the total ratings of all games [info] - should return the total

Why am I getting this error when running Scala 2.13 tests in IntelliJ, but not with Scala 2.12?

陌路散爱 提交于 2019-12-18 18:55:12
问题 I am getting the following error when I try to run tests in IntelliJ (2019.1), Scala IntelliJ plugin v2019.1.8, with Scala 2.13: Exception in thread "ScalaTest-dispatcher" java.lang.NoSuchMethodError: scala.collection.JavaConverters.seqAsJavaListConverter(Lscala/collection/Seq;)Lscala/collection/convert/Decorators$AsJava; at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder.getOrdinalList(ParallelTreeBuilder.java:21) at org.jetbrains.plugins.scala

What is the === (triple-equals) operator in Scala Koans?

浪子不回头ぞ 提交于 2019-12-18 11:38:22
问题 I started working my way through the Scala Koans, which is organized around a suite of unit tests with blanks that one needs to fill in. (This idea was modeled after a similar Ruby Koans project.) You start the sbt tool running a test, and it admonishes: [info] + ***************************************** [info] + [info] + [info] + [info] + Please meditate on koan "None equals None" of suite "AboutEmptyValues" [info] + [info] + [info] + [info] + ***************************************** ...and