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

SBT - using two versions of library in a single project?

I have a project with a bunch of tests written for Scalatest 1.x, which use the ShouldMatchers class, which was deprecated in version 2.x. Going forward, I want to use version 2 for new tests, but this will mean I have to refactor all my existing…
Luigi Plinge
  • 50,650
  • 20
  • 113
  • 180
0
votes
1 answer

Scalatest Playframework must contain List[String]

I am using playframework 2.4.x, and this libraries "org.scalatest" %% "scalatest" % "2.2.1" % "test" "org.scalatestplus" %% "play" % "1.4.0-M3" % "test" I want to check if therea are some strings in a List I build on the test, this is the code val…
agusgambina
  • 6,229
  • 14
  • 54
  • 94
0
votes
2 answers

How to use mocks in Scala to mock a singleton object

I recently started programming in Scala. I have a project with a hierarchy of classes that call each other. Eventually, they last one calls a singleton DAL (Data Access Layer) object that calls a stored procedure in MySQL. I have a DAL object with…
Traveling Tech Guy
  • 27,194
  • 23
  • 111
  • 159
0
votes
4 answers

ScalaMock won't mock my TextMessage

I am using ScalaMock3 and I am trying to create a mock of a javax.jms.TextMessage within my ScalaTest spec. import javax.jms.TextMessage import org.scalamock.scalatest.MockFactory import org.scalatest.{Matchers, WordSpecLike} class MySpec extends…
mdm
  • 3,928
  • 3
  • 27
  • 43
0
votes
1 answer

How can I see diagnostic debug info in my Slick tests to fix poor performance?

I'm having trouble figuring out what's happening with slow-executing integrations tests, using Slick to write to the database. But, I can't figure out how to access diagnostic logging, via SLF4J.
acjay
  • 34,571
  • 6
  • 57
  • 100
0
votes
2 answers

How to reach to static method from class instance for mock

I need to stub Java.util.concurrent.Executors class newFixedThreadPool method and verify it. Executors.newFixedThreadPool(executorServiceThreadCount, threadFactory) I tried create a global Executors value for overriding from test fragment. …
0
votes
1 answer

Recreate database in Play with evolution for each test in OneAppPerTest

I am using Playframework 2.4.6 (want to update to the new version 2.5.0) with Play-Slick. I have problems to change my unit and integrationtests. When I want to test my controller, I need the database in default status for each test. That means…
gun
  • 1,046
  • 11
  • 22
0
votes
1 answer

Dynamically test generating in Java or Scala

I have a big json file with list of tests. Json file contains several filenames, which contains names of test classes, which have some setup stuff and a list of tests. Here is an example of such json file: { "filename1.py": { "ClassName": [ …
alex
  • 942
  • 1
  • 10
  • 26
0
votes
1 answer

Playframework Scala dinamically setup routes for scalatest

I am trying to write some integration tests. What I want to achieve is to setup a couple of fake URLs to emulate third party services. I want to know if it is possible to set dynamically URL path for test. For example I have this code In a base file…
agusgambina
  • 6,229
  • 14
  • 54
  • 94
0
votes
1 answer

Tagging lots of tests at once in ScalaTest

I know i can tag a test using the taggedAs method (I'm using FlatSpec right now) like this: \/\/\/\/\/\/\/\/\/ it should "not deadlock" taggedAs SlowTest in { …
coderatchet
  • 8,120
  • 17
  • 69
  • 125
0
votes
2 answers

Selenium and scalaTest error

i have a problem, I'm trying to follow a chapter 5 of the book "sbt in Action" And i have a problem that i don't understand what is wrong... this is my SeleniumSpec.scala package org.preownedkittens; import org.scalatest._ import…
Julio
  • 3
  • 1
0
votes
0 answers

How to output Specs2 result to a file

I have code something like this class HelloWorldSpec extends Specification { "This is a specification for the 'Hello world' string".txt "The 'Hello world' string should" >> { "contain 11 characters" >> { "Hello world" must…
Sanjay Rabari
  • 2,091
  • 1
  • 17
  • 32
0
votes
1 answer

how to get variable value is spec statements?

I have code like this "When some call is made, status is (+value+)" in { Get("/path") ~> routeToCall ~> check { // some statements status === OK <---- this value I want in When Statment } } whatever…
Sanjay Rabari
  • 2,091
  • 1
  • 17
  • 32
0
votes
0 answers

Spec file output in Logger File

I have written scala test file using spec, the spec file's output comes console but not in logger file. Though my logback.xml configuration is same for both?
Sanjay Rabari
  • 2,091
  • 1
  • 17
  • 32
0
votes
0 answers

Running Scala Spec getting Error ..could not find implicit value for parameter ta

I have someTrait that extends Actor ( becuase it using some actor ref inside) trait DemoService extends Actor { def actorRefFactory = context implicit def executionContext = actorRefFactory.dispatcher val demoRoute = { get { …
Sanjay Rabari
  • 2,091
  • 1
  • 17
  • 32