Questions tagged [utest]

utest (pronounced micro-test) is a lightweight testing library for Scala.

uTest (pronounced micro-test) is a lightweight testing library for Scala.

https://github.com/lihaoyi/utest

21 questions
5
votes
1 answer

How can I debug scala.js unit tests?

I have some scala.js unit tests written in utest. They all run just fine from the sbt build, however I would like to be able to step through the unit tests in a debugger. Using my favorite IDE (intellij) to debug the tests won't work because it will…
Julie
  • 6,221
  • 3
  • 31
  • 37
3
votes
1 answer

How to run ScalaJs tests in real browser?

Is it possible to run generated js test code in browser? ScalaJS seems to generate following js files under target directory (project-name)-test-fastopt.js (project-name)-test-jsdeps.js before running tests. Is it possible to run these tests in…
user4955663
  • 1,039
  • 2
  • 13
  • 21
3
votes
1 answer

How do I test scala.js programs for side-effects that happen asynchronously using µtest?

I have a µtest suite that needs to check that some asynchronous operation eventually has a side effect. Since javascript (and thus scala.js) is single threadded, it is not possible to block and wait for the side effect to happen. Also, the µtest…
Julie
  • 6,221
  • 3
  • 31
  • 37
2
votes
1 answer

How to deeply compare two js like objects in scala.js?

Since js.Dynamic.literal() != js.Dynamic.literal(), what is the suggested way to test equality for two literals? I don't want to characterize those literals with traits. I want to know if they are deeply equal. What I'm doing right now is the…
gurghet
  • 7,591
  • 4
  • 36
  • 63
2
votes
1 answer

ScalaJs With Play Framework (Error in Tests)

I am trying to use ScalaJs cross build project with Play Framework 2.5. I am facing a problem when I am trying to run the tests for Client.scala . The error I am getting is - caused by: TypeError: Cannot call method "appendChild" of null . Client…
2
votes
1 answer

sbt play cross build project setup: uTest runner doesn't seperate client/server projects correctly

I'm using an build.sbt which has cross compile settings and basically is an adapted version of "Play with scala-js example" and having some trouble getting a clean setup for my tests. Specifically, when running my server tests, my client tests also…
Simon Lischka
  • 155
  • 12
1
vote
1 answer

Integrate µTest (micro test) for Scala into a Gradle project

I'm using Gradle for my Scala projects and a bit frustrated about documentation of scalatest. So I searched for a alternative test framework. The only one I found was µTest (micro test). But so far I could not found a way to integrate µTest into…
oRUMOo
  • 153
  • 1
  • 2
  • 11
1
vote
1 answer

How can I test future failure in a TestSuite with utest?

I would like to know the equivalence of recoverToSucceededIf in scalatest in µtest. In fact, the github page shows the runAsync method which AFAIK is a TestRunner method. Best regards
1
vote
1 answer

Is there a way to ignore a test in uTest?

For example, spec2 has a feature "Pending until fixed". Is there a way to ignore a test in µTest?
Alex Karasev
  • 1,108
  • 2
  • 13
  • 24
1
vote
0 answers

ScalaJs Test with utest

I am working on a cross built ScalaJs project and have written ScalaJs Tests using utest. It was initially working fine and test cases did compile and gave result but now I am suddenly getting the below mentioned error. Please tell me as to what may…
1
vote
0 answers

How to use uTest-wrapping with scalajs sbt test to test async events?

I tried the uTest test wrapping in GitHub with the following code: object AjaxExp01SOTest extends TestSuite { val log = JSLog.getLogger(getClass().getSimpleName) JSLog.setGlobalLevel(Level.DEBUG) def tests = TestSuite { "OK: GET slP" -…
user4955663
  • 1,039
  • 2
  • 13
  • 21
1
vote
2 answers

How to get the name of the current scalajs / uTest test case

How can I get the name of the currently running uTest test case? During the test case I usually use println(...) or log.debug(...) to print and check various values. At the beginning of the test case I print the name of the test case. I can always…
user4955663
  • 1,039
  • 2
  • 13
  • 21
1
vote
1 answer

cannot get uTest to run tests

I am following the Basic Tutorial over at Scala.JS. I've also followed Cannot get uTest to see my tests I update my build.sbt to have the following: testFrameworks += new TestFramework("utest.runner.Framework") libraryDependencies += "com.lihaoyi"…
Tom K
  • 145
  • 1
  • 13
1
vote
1 answer

Mock Scala.js classes

I'm trying to test React component written in Scala.js, which fetches list of categories from the server. I was able to provide alternative jQuery instance to the component, but jQuery mock itself cannot be compiled. Here is mock's code: import…
Bartek Andrzejczak
  • 1,292
  • 2
  • 14
  • 27
0
votes
1 answer

I need to write utest in Python for below method

Function prototype : def sample_test(self, param1, param2, optional_param1=False, optional_param2=False, optional_param3={}): if optional_param2: print("In param2") if optional_param3: print("In param3") Now if I…
1
2