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 Test - Ignore excludes and run everything

I have a Play framework with a bunch of tests (which are run with ScalaTest), and I am trying to organize them by: Unit test Integration Test Read Integration Test Write I have left all of my unit tests untagged, and have created the following…
Tyler
  • 17,669
  • 10
  • 51
  • 89
0
votes
1 answer

getting scheme java.lang.NullPointerException: scheme while trying to fake a server call in my service

I have a service class in my project and I want to test one of its methods that is performing an api call, so I want to catch this call and return something fake so I can test my method, it looks like this: class MyService @Inject()(implicit config:…
jack miao
  • 1,398
  • 1
  • 16
  • 32
0
votes
2 answers

ScalaMock Stubbing with default parameters

I'm trying to mock a function like def foo(x: A, y: B, z: C = blah) where blah is a java connection object that I don't want to create on the spot However when I try to stub it like (object.foo _) .stubs(a, b) It errors out and says…
fuzzycuffs
  • 139
  • 1
  • 15
0
votes
1 answer

sbt cross project, shared dependencies for test example

I have a small project. Where I have the following problem: scalaTest needs to be added to all three dependency project (client, server, shared), otherwise the scalatest library is not accessible from all projects. In other words, if I write val…
jhegedus
  • 20,244
  • 16
  • 99
  • 167
0
votes
1 answer

SCALA: Is it possible to prepare a regression suite(integration tests) for Restful API's with scalatest

I am writing a regression suite for API's using SCALATEST, I am kind of stuck-up with following scenario: For instance I have two tests: test-1{ Call for API-1 Call for API-2 Call for API-3 } test-2{ Call for API-5 Call for API-6 Call for API-7 } I…
Saquib Gul
  • 69
  • 2
  • 9
0
votes
2 answers

What could be best approach for regression suite for microservices, Can Scala be used for that?

I was asked to prepare a regression suite for testing micro-services, for that I need to: - Run scripts - Run different API's (can be multiple for scenarios to be used in next API) - Publish result in some presentable format My own first choice was…
Saquib Gul
  • 69
  • 2
  • 9
0
votes
1 answer

Injecting Play Application for a Slick Database Service

This is regarding a Play 2.3 application that I am trying to introduce Guice into. I have the following legacy code to Guicify and I reached this point class DatabaseService { def db: Database = DB(play.api.Play.current) //More code…
Serendipity
  • 1,015
  • 1
  • 10
  • 19
0
votes
2 answers

Scalatest with eclipse shows errors while using Matchers

I have an eclipse scala project which uses maven. Eclipse plugins for ScalaIDE and Scalatest are installed. I have tests like: import org.scalatest._ class ExampleSpec extends FlatSpec with Matchers { feature("Feature A Test") { …
rgamber
  • 5,749
  • 10
  • 55
  • 99
0
votes
1 answer

Share static data between test runs in sbt

I have tests that require an expensive loading of static data to run rendering test watching via ~test effectively useless. Is there a way to load the data once each sbt load and cache it between test runs? The tests are using scalatest.
Klugscheißer
  • 1,575
  • 1
  • 11
  • 24
0
votes
0 answers

IntelliJ IDEA can't run Scala test

My project is maven 3 based, mixed Java and Scala. I can't run scalaTest in IDEA, IDEA complained: Error:scala: Error: org.jetbrains.jps.incremental.scala.remote.ServerExceptionjava.lang.NullPointerException at…
Zava
  • 743
  • 6
  • 17
0
votes
2 answers

How to get the failure that happens in another class scope in my test?

I have a function in my service that takes some jvalue data, extract it and return some model. def getInstanceOf(data: JValue, aType: String): Living = aType match { case "person" => data.extract[Person] case "animal" =>…
jack miao
  • 1,398
  • 1
  • 16
  • 32
0
votes
1 answer

Run spark microbenchmarks using sbt

I've a cloned setup of Spark. It has a microbenchmark suite which is located here. If I browse to a particular file e.g. AggregateBenchmark.scala, I see the instructions in the comments to perform the benchmarks. * To run this: * build/sbt…
user2512324
  • 791
  • 1
  • 6
  • 21
0
votes
1 answer

Unable to start instance of StubbedCassandra in Scala

I am trying to start an instance of StubbedCassandra in Scala with Maven and ScalaTest, based on the documentation found here: http://scassandra-docs.readthedocs.io/en/latest/java/overview/ val scassandra =…
0
votes
1 answer

using keyword running in scala test

when i attempt to run a fake application in a scala test based off of some article the keyword running isn't recognized. Is running part of a scala library? "be retrieved by id" in { running(FakeApplication()) { } }
richs
  • 4,699
  • 10
  • 43
  • 56
0
votes
1 answer

scala test play parse.mulipartFormData

Attempting to test a play function that parses a multipartFormData def requestBulkSiteSbcActionConfirm = Action.async(parse.multipartFormData) { request => .... The test i've created is val temporartyFile = TemporaryFile("test") val…
richs
  • 4,699
  • 10
  • 43
  • 56