scalatest Questions

2

Solved

I can find many examples of setting maximum sizes for generators, but how do I generate lists between a min and max length?

2

Solved

I've created a Config object with a get method to return different strings based on the PROJECT_ENV environment variable. If PROJECT_ENV=test, then Config.get("somePath") returns some/path.csv, oth...
Ourself asked 6/10, 2016 at 17:16

2

Solved

I'm using ScalaTest 2.0 and ScalaMock 3.0.1. How do I assert that a method of a mocked trait is called never? import org.scalatest._ import org.scalamock._ import org.scalamock.scalatest.MockFacto...
Rayner asked 7/1, 2014 at 12:41

2

If you match lists or maps or any other complex structures it's useful to see the difference between what is given and what expected. For example: Map("a" -> 1, "b" -> 2, "c" -> 3) should...
Furrow asked 15/2, 2015 at 17:17

5

Solved

Is it possible to access the name of the currently executing test, from within a ScalaTest test? (And how would I do it?) Background: I'm testing that my Data Access Object eventually throws an O...
Oblige asked 12/2, 2013 at 11:15

2

Solved

I’m testing a Spark Streaming application with the help of "com.holdenkarau.spark-testing-base" and scalatest. import com.holdenkarau.spark.testing.StreamingSuiteBase import org.apache.spark.rdd.R...
Carinacarinate asked 7/2, 2017 at 3:7

7

Solved

I'm using mockito with scalatest. I have following problem when using matcher with value class. import org.scalatest.FlatSpec import org.scalatest.mock.MockitoSugar import org.mockito.BDDMockito...
Ungenerous asked 4/12, 2014 at 8:53

7

Solved

I have this code that is working 100% from sbt , executing sbt test but throw a compilation error in Intellij Idea. import org.scalatest.{BeforeAndAfter, FunSuite, GivenWhenThen} class SimpleTest...
Gwenette asked 10/1, 2017 at 9:2

6

Solved

It is possible to run a single, selected JUnit test method in IntelliJ IDEA 12, however this does not seem to be possible with ScalaTest. You can run the whole test class or nothing, but there seem...
Lullaby asked 25/1, 2014 at 16:30

2

After cloning an SBT repo and trying to launch SBT shell inside the directory, I'm getting the following error java.lang.IllegalArgumentException: requirement failed: Configurations already specif...
Psittacine asked 21/12, 2017 at 13:16

2

Solved

I'm trying to write a unit test for a function that returns a tuple of a class that contains an array. A simple assert(out === expectedOut) or out should be(expectedOut) does not compare the conte...
Hortensehortensia asked 6/4, 2016 at 11:24

2

Solved

It is possible to use ScalaTest in a Java test file, and if so where can I find examples? When I try something like: // MyUTest.java import org.scalatest.flatspec.AnyFlatSpec; import org.scalatest...
Croissant asked 16/12, 2020 at 19:32

2

Solved

Is there any way to test a nested function (ideally with ScalaTest)? For example, is there a way to test g() in the below code: def f() = { def g() = "a string!" g() + "– says g" }
Strouse asked 17/3, 2011 at 0:6

6

Solved

How to disable a test suite, i.e. all tests inside class extending FunSpec? The only solution I'd found is to replace it with ignore in front of each test, but it is boring to do so with the dozen...
Hasidism asked 17/7, 2012 at 4:30

3

Solved

What is the method to disable logging on the scalatest log4j messages: The log4j.properties is as follows: log4j.rootLogger=INFO,CA,FA #Console Appender log4j.appender.CA=org.apache.log4j.Consol...
Directive asked 1/12, 2014 at 0:42

1

I am using a Suite (Scalatest-version: 3.2.2) which has several TestSuites inside: class SuiteMixedSequentialParallel extends Stepwise( new TestInParallel, new TestSequentially ) Now, I want, ...
Congruity asked 1/9, 2020 at 7:23

2

With the junit-interface runner, there was this handy option: -q Suppress stdout for successful tests. Stderr is printed to the console normally. Stdout is written to a buffer and discarded wh...
Dierdre asked 5/8, 2013 at 16:47

2

Solved

Getting Below exception , when i tried to perform unit tests for my spark streaming code on SBT windows using scalatest. sbt testOnly <<ClassName>> * * * * * * 2018-06-18 02...
Doucette asked 18/6, 2018 at 10:28

1

Solved

I want to start writing simple tests in Scala using ScalaTest. But for some reason, I can access org.scalatest but not org.scalatest.FunSuite This is what my build.sbt looks like: name := "Alg...
Leifeste asked 1/7, 2020 at 15:12

1

Solved

I have these test dependencies defined / Test Dependencies lazy val wiremock = "com.github.tomakehurst" % "wiremock-jre8" % "2.25.1" lazy val playTest = "com.typesafe.play" %% "play-test" % "2.8.1...
Eldredge asked 12/5, 2020 at 22:27

3

I'm writing a Scala test with some ScalaTest matchers. When my test fails, intellij says something like {"count":3,"pagination":{"offset":0,"limit":100},"content":{"uri":"http://locahost.com/cat...
Daradarach asked 29/1, 2015 at 12:9

5

Solved

I know that a single test can be ran by running, in sbt, testOnly *class -- -n Tag Is there a way of telling sbt/scalatest to run a single test without tags? For example: testOnly *class -- -X...
Precedence asked 22/6, 2012 at 16:4

1

Solved

Assume I have case class with several field members: case class User(name: String, ..., createdAt: LocalDateTime) How could I check equality without taking into account createdAt field? Is there a...
Time asked 12/2, 2020 at 23:5

3

Solved

I am testing a parser I have written in Scala using ScalaTest. The parser handles one file at a time and it has a singleton object like following: class Parser{...} object Resolver {...} The tes...
Kylynn asked 4/8, 2010 at 21:45

10

Solved

I'm trying to run a scala flatspec test within Intellij IDEA (latest community build, with latest Scala plugin), but I keep getting "Empty test suite" errors. I tried using the normal "run" menu o...
Mendelian asked 22/12, 2010 at 11:43

© 2022 - 2024 — McMap. All rights reserved.