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

Manual Dependancy Injection App testing Play 2.5.x

I have project with manual dependency injection. Can I test my application with standard Play test suite? play.application.loader="AppLoader" class AppLoader extends ApplicationLoader { override def load(context: Context): Application = { …
0
votes
1 answer

Does Await have overhead in test case

I have a very simple test cases(scalatest, but doesn't matter) and I provide two implementation of accessing some resources, this method returns either Try or some case class instance. Test cases: "ResourceLoader" must "successfully initialize…
Slow Harry
  • 1,857
  • 3
  • 24
  • 42
0
votes
1 answer

Scalatest maven plugin: ERROR: -c has been deprecated for a very long time and is no longer supported

I'm using the scalatest-maven-plugin latest 1.0 version, with source code here. Trying to run my suites in parallel and using the following configuration: org.scalatest
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
0
votes
1 answer

ScalaTest - How to verify a collection contains a sub class

With ScalaTest, it's straightforward enough to test that an object is of a particular class with something like: myPet shouldBe a [Dog] But what I would like to do is verify that a collection of some base type has at least one of a particular sub…
Jason Nesbitt
  • 730
  • 1
  • 6
  • 15
0
votes
0 answers

In Intellij, the 'Select Run/Debug Configuration' is hiding due to large default test name, also hiding other icons after it

Each time I right click and run a test, the intellij, picks a large test name for the 'test-run' and hence, hiding the 'Select Run/Debug Configuration' icon and all those which come after it. What can i do to collapse the test name, so that…
N A
  • 831
  • 2
  • 8
  • 28
0
votes
1 answer

How to chain function arguments in Scala?

I'd like to define my tests using the following function (ignore some dependencies for now e.g. fixture1 etc they are at the bottom): multiTest("my test name", fixture1) { case (x: Double, y: Int, z: String) => // test body } and multiTest is…
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
0
votes
1 answer

ScalaTest: testing web apps with multiple browsers

I am trying to have the same integration test for a web app with multiple browsers (Chrome, Firefox, InternetExplorer, etc. one after the other). ScalaTest plus Play has these traits AllBrowsersPerTest and AllBrowsersPerSuite. Did anyone wrote…
Marcus
  • 1,857
  • 4
  • 22
  • 44
0
votes
1 answer

Circular Generators hanging indefinately

I have a set of names in a file. I need to implement a Generator that iterates through them continually. However, the code is hanging indefinitely at if (iter.hasNext) after the first pass. Gen code var asStream =…
Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
0
votes
2 answers

How to show ScalaTest tests nicely in TeamCity

I am new to Scala and integrating it in an existing Java project. The project is built with Maven (already configured the pom.xml successfully to compile and both Java and Scala code and run both lang's tests in a single project). Our TeamCity…
dux2
  • 1,770
  • 1
  • 21
  • 27
0
votes
1 answer

How to test Camel using ScalaTest

I want to unit test Camel code using ScalaTest and the FunSpec test style. To do so, I need to extend from both FunSpec and CamelTestSupport. However, both these are classes and at least one needs to be a trait in order to do this in Scala. For…
drsquidop
  • 428
  • 4
  • 12
0
votes
1 answer

Distinguishing between expected and actual values in ScalaTest using matchers

In ScalaTest you can distinguish between expected and actual values in assertions using the assertResult macro like this: assertResult(expected) { actual } This will print a "Expected X, but got Y" message when the test fails, instead of the usual…
Ori Popowski
  • 10,432
  • 15
  • 57
  • 79
0
votes
1 answer

How to use ShouldVerb with Double types?

I am new to using the fully fledged scalatest and the relatively new ShouldVerb in version 3.0.0 (ex ShouldMatchers). What I'd like to test is something along the lines of the following: import org.scalatest.FunSuite import…
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
0
votes
1 answer

scala higher kinds and scalatic Equality

Been playing around with scalas type system and again i find myself fighting it. I have created a Vector library for some simple graphics applications and im fairly happy with it. Now i want to be able to test the Vector properties with scalacheck…
Patrik
  • 255
  • 3
  • 11
0
votes
1 answer

Behaviour within SBT vs launching SBT

I'm having an issue where a particular tests fails using test-only within an sbt session, e.g sbt > test-only package.Test where as running as a single command works fine. E.g sbt 'test-only package.Test' I wonder why the behaviour would be…
Oliver Shaw
  • 5,235
  • 4
  • 26
  • 35
0
votes
1 answer

Close or shutdown of H2 database after tests is not working

I am facing a problem of database clean-up after each test when using scalatest with Slick. Here is code of the test: class H2DatabaseSpec extends WordSpec with Matchers with ScalaFutures with BeforeAndAfter { implicit override val patienceConfig…
Marek J
  • 1,364
  • 8
  • 18
  • 33