Questions tagged [scalatest]

The Scala testing framework

ScalaTest is a testing framework for Scala, which can test either Scala or Java code.

It supports a number of different testing styles, as JUnit, TestNG, FunSuite (For test-driven development), Spec (for behaviour driven development) and FeatureSpec (for functional, integration, or acceptance testing).

1597 questions
0
votes
1 answer

Screenshot on every failure using Scalatest

I would like to take a screenshot on every fail test in a Spec or Suite using ScalaTest. The Scala Test website shows how to take screenshots surrounding every code that might fail with this: withScreenshot { …
Tom
  • 1,387
  • 3
  • 19
  • 30
0
votes
1 answer

Importing implicit methods in scalatest

I'm struggling to understand why implicit imports do not work as I expect them in scalatest. The simplified failing example (using spark, but I can make it fail with my custom class also) is as follows: class FailingSpec extends FlatSpec with…
psarka
  • 1,562
  • 1
  • 13
  • 25
0
votes
0 answers

sbt test hangs on 'Running TaskDef'

I'm trying to run a simple fibonacci problem with unit tests from a scala tutorial. it has been working but suddently stopped & I don't know why- specifically it hangs at 'running taskdef' when using sbt debug test. The directory structure…
erikdstock
  • 1,117
  • 9
  • 16
0
votes
1 answer

Akka HTTP Java: not override abstract method yeOldeTestNames() in org.scalatest.Suite

I am going to use akka-http with Java. The routing done successfully and run. But when i trying to write test case using JUnitRouteTest, i got an error. com.james.controllers.PingPongApiTest is not abstract and does not override abstract method…
Harmeet Singh Taara
  • 6,483
  • 20
  • 73
  • 126
0
votes
1 answer

Testing a PlayFramework (2.5.x) Web API using ScalaTest

I'm trying to test my web api using ScalaTest and I can't get the API to execute my siteData() action. The following code results in a 400, but running the same payload from the outside works just fine. class DeviceApiSpec extends…
andyczerwonka
  • 4,230
  • 5
  • 34
  • 57
0
votes
1 answer

Logging the time for each test (and/or testSuite) with scala test

I'm using scala test for my tests, and some time ago the builds started to fail sometimes because some (new, probably) test takes more than the limit allowed by the CI. At first sight no test should take more than the timeout (10 minutes btw), and…
pedrorijo91
  • 7,635
  • 9
  • 44
  • 82
0
votes
0 answers

SprayJson: missing required member during marshalling

I have case class case class CreateOffer(playerId: Option[PlayerId], modifier: Double, expiry: DateTime, start: DateTime, notification: String) When I try in test to Post this in spray val req = Post("/create", createOffer) ~> …
0
votes
1 answer

enable implicit import for runtime type in scala check. "could not find implicit value for parameter"

I'm testing my own home-brewed Monoid classes in scala using the ScalaCheck library and ScalaTest when attempting to implement DRY tests, I get the implicit error in the title: Error:(16, 12) could not find implicit value for parameter arbA:…
coderatchet
  • 8,120
  • 17
  • 69
  • 125
0
votes
1 answer

ScalaCheck nested Gen

In ScalaCheck it seems that a mapped/flatMapped Gen will fail as soon as any inner gen has a value filtered out. E.g. (using ScalaTest) class ScalaCheckGen extends FreeSpec with GeneratorDrivenPropertyChecks { "Fails" in { …
Pengin
  • 4,692
  • 6
  • 36
  • 62
0
votes
2 answers

How to override an implicit conversion in my scala test?

I am working on a scala test that tests the code which uses implicit conversion methods. I don't want to use those implicit conversions and would like to mock/override them in the test. Is it possible to do that ? implicit class Typeconverter(objA:…
0
votes
1 answer

String include assertion without parentheses with ScalaTest Matchers

On http://www.artima.com/weblogs/viewpost.jsp?thread=246279 I've found that the following assertions should work: string should startWith substring "Hello" string should endWith substring "world" string should include substring "seven" However,…
Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
0
votes
1 answer

Can Gen[String] Produce Other Values?

Given: import org.scalatest._ import org.scalatest.prop.Checkers import org.scalacheck.Gen import org.scalacheck.Gen._ object Test { def fooOrBar: Gen[String] = oneOf("foo", "bar") } class Test extends FunSuite with Checkers { import Test._ …
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
0
votes
1 answer

What is the difference between should and must in scala testing?

Both scalatest and Specs2 have separate matchers for should and must. However, I cannot find any explanation for why you would use one or the other. What exactly is the difference?
OrangeDog
  • 36,653
  • 12
  • 122
  • 207
0
votes
0 answers

How to wrap scalatest test in a Future?

I'm testing a socket connection using scalatest and opening the connection is an asynchronous operation, to prevent the test completing before the async operating completes I'm attempting to wrap in a Future : import io.backchat.hookup._ it…
blue-sky
  • 51,962
  • 152
  • 427
  • 752
0
votes
1 answer

Run a single test suite from build.sbt

I have a multi-module project and currently run tests during packaging by a task which reads - val testALL = taskKey[Unit]("Test ALL Modules") testALL := { (test in Test in module_A).value (test in Test in module_B).value (test in Test in…
Bharadwaj
  • 1,361
  • 1
  • 9
  • 24