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
2 answers

IntelliJ IDEA does not let me run ScalaTests from an SBT project any more

I have a strange problem in IntelliJ IDEA: I have an SBT project which has ScalaTests. I organized my settings in blocks like this: lazy val common = Seq( organization := "com.example.foo", version := "0.0.1-SNAPSHOT", scalaVersion :=…
rabejens
  • 7,594
  • 11
  • 56
  • 104
0
votes
1 answer

Specs2 Scala bug not evaluating strings to be the same

I have the following spec2 test import akka.testkit._ import akka.actor.ActorSystem import com.github.nfldb.config.{NflDbApiActorSystemConfig, NflDbApiDbConfigTest} import org.scalatest.MustMatchers import org.specs2.mutable.Specification import…
Chris Stewart
  • 1,641
  • 2
  • 28
  • 60
0
votes
1 answer

TypeSafe-Activator ScalaTest value in is not a member of String

I am trying to run the test of a project I cloned. I am new to Scala and Activator and I can not figure out what is happening in the root folder I have the build.sbt name := "xxxxx" version := "2.0-SNAPSHOT" scalaVersion := "2.11.5" doc in…
agusgambina
  • 6,229
  • 14
  • 54
  • 94
0
votes
2 answers

Mocking Play WSRequestHolder get method using Scalamock

I'm trying to test the following line of code using ScalaTest and ScalaMock. val responseFuture = wsClient.url(url).withQueryString(params: _*).get() wsClient type is THttpClient, which is a wrapper of play.api.libs.ws.WS. Given that: val…
user2664655
  • 251
  • 1
  • 3
  • 9
0
votes
2 answers

How to test non-public methods?

I am learning Scala and wrote Email class which looks like: class Email(emailConfigName: String) { private val emailConfig = ConfigFactory.load(emailConfigName) getConfig ("email") def notifySupportForTenant(symbolicName: String) { val…
daydreamer
  • 87,243
  • 191
  • 450
  • 722
0
votes
1 answer

Scalatest Error When Using FlatSpec

I ran my test, which failed, but for the following (seemingly-contradictory) reason: should return an myClassVector *** FAILED *** [info] Expected myClassVector(3, 9, 12), but got myClassVector(3, 9, 12) Here is my actual test: class…
nietsnegttiw
  • 371
  • 1
  • 5
  • 16
0
votes
1 answer

cannot compile scala test with intellij 14.1

The project uses scala 2.9 my scalatest dependency is: org.scalatest scalatest_2.9.2 Error:scalac: Error:…
Jas
  • 14,493
  • 27
  • 97
  • 148
0
votes
2 answers

Attempting to run a trivial Scalatest on a Spray Route

Ultimately my goal is to write a custom Spray Directive for use by various routes in an existing application. I have so far been unable to write a test for my new directive, so I simplified further until my custom code wasn't even in play. I'm…
broadmonkey
  • 124
  • 2
  • 9
0
votes
1 answer

Casting a Scala Object into a Generic type?

Firstly, some background: I'm currently writing a generic solver for a certain class of problems (specifically, a structural SVM solver) in Scala. In order to use this, the user has to implement an interface. Consider a simplified version of the…
Tribhuvanesh
  • 13
  • 1
  • 4
0
votes
2 answers

How to test properties of random generator

Using Scala, I've a method that return a set of 5 random numbers, that should be between 1 and a constant LIMIT. What's the best approach to test that a answer will never return more/less than 5 elements, and all elements are between 1 and LIMIT?…
pedrorijo91
  • 7,635
  • 9
  • 44
  • 82
0
votes
0 answers

Valgrind and ScalaTest

We want to use valgrind to detect memory leaks from one of our libraries. The library is written in scala and has a suite of ScalaTest libraries associated with it. If we run all the tests against the ScalaTest runner on the command line, everything…
0
votes
2 answers

Kafka test failing/succeding intermittently

I am trying to write a simple test for an abstraction of the kafka scala client in kafka 0.8.2. It basically just writes a message to kafka and I then try to read it back. However, I had problems with it failing intermittantly so I boiled the test…
Emil L
  • 20,219
  • 3
  • 44
  • 65
0
votes
0 answers

Selenium testing with lists for load performance

I'm attempting to use a unit test of mine for "load" testing on our browser. For various reasons, we have seen performance degradation on the browser side, because we heavily rely on the print dialog. I have the following unit test working via…
mrkaiser
  • 149
  • 7
0
votes
1 answer

Run scalatest in main instead of test through sbt?

Say I have a Scalatest file in the main directory, is there a sbt command to run the test such as testOnly or `runMain'? On IntelliJ, you are given the option to run the test.
ferk86
  • 2,325
  • 1
  • 23
  • 27
0
votes
1 answer

How do I unit test closures with deeply nested anonymous functions in Scala?

I'm trying to unit test a method that looks like this: def foo() = { val a = Listener.registerCallback( (bar: Bar, baz: Baz) => { val x = bar.declare().get bar.bind(x) }) return a } I can easily test the result of this method.…
nmurthy
  • 1,337
  • 1
  • 12
  • 24
1 2 3
99
100