New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Custom test configuration #42

Closed
l15k4 opened this Issue Nov 18, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@l15k4
Copy link
Contributor

l15k4 commented Nov 18, 2014

Hi,

I'm trying to create multiple test configurations because async tests require PhantomJS(autoExit =false), but I think that utest doesn't support setting a filter in testOptions, at least I couldn't figure that out. I was playing with this setup :

  lazy val AsyncTest = config("async") extend(Test)

  lazy val js =
    project.in(file("js"))
      .configs(AsyncTest)
      .settings(scalaJSSettings:_*)
      .settings(utestJsSettings:_*)
      .settings(inConfig(AsyncTest)(Defaults.testSettings ++ utestJsSettings) :_*)
      .settings(
        persistLauncher in AsyncTest := false,
        testOptions in AsyncTest := Seq(Tests.Filter(s => s.contains("Async"))),
        postLinkJSEnv in AsyncTest := new PhantomJSEnv(autoExit = false),
       )

But the testOptions never works, either all tests are executed or none is.

Do you have any idea how to make it work, or what might be the problem ?

@lihaoyi

This comment has been minimized.

Copy link
Owner

lihaoyi commented Nov 27, 2014

I'm afraid I don't know what that Tests.Filter thing is =/ if you can figure it out and send a PR to make it work that'd be great. It probably ties in with the sbt.TestFramework stuff but I'm totally unfamiliar

@l15k4

This comment has been minimized.

Copy link
Contributor

l15k4 commented Nov 27, 2014

I went to the sbt.TestFramework rabbit hole a little bit but sbt isn't really my strong point. I ended up doing it this way, in short, I started to use uTest directly/programmatically to have much more control over that...

SemanticBeeng added a commit to SemanticBeeng/play-scalajs-showcase that referenced this issue Feb 3, 2015

wip: evolving tests
Refactored core test logic towards being able to run from uTest as well as Specs2
Moved it to 'shared' to ensure it builds in ScalaJs

Wrote tests same way in uTest but does not run

 -----
 [jvm] $  last js/test:loadedTestFrameworks
 org.mozilla.javascript.JavaScriptException: scala.scalajs.runtime.UndefinedBehaviorError: An undefined behavior was detected: ReturnVal(Left(TaskId(1)),Queue(TaskScheduled(Task(TaskId(1),Do this,true)))) is not an instance of scala.util.Try (Lorg_scalajs_testinterface_internal_BridgeBase.sjsir#46)
 -----

 Follow up on these:
 * lihaoyi/utest#33 (comment)

*  lihaoyi/utest#42

SemanticBeeng added a commit to SemanticBeeng/play-scalajs-showcase that referenced this issue Feb 3, 2015

wip: evolving tests
Refactored core test logic towards being able to run from uTest as well as Specs2
Moved it to 'shared' to ensure it builds in ScalaJs

Wrote tests same way in uTest but does not run

 -----
[jvm] $ +js/test
[info] Setting version to 2.11.2
[info] Set current project to jvm (in build file:/home/nickdsc/projects/playframework-learn/play-scalajs-showcase/)

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "sbt-web-scheduler-1"
[trace] Stack trace suppressed: run last js/test:test for the full output.
[error] Could not run test domain.TaskManagementSpecuTest: java.util.concurrent.ExecutionException: Boxed Error
[trace] Stack trace suppressed: run last js/test:executeTests for the full output.
[error] (js/test:executeTests) java.util.concurrent.ExecutionException: Boxed Error
[error] Total time: 335 s, completed Feb 2, 2015 7:08:23 PM
[jvm] $ last js/test:test
[debug] Running TaskDef(domain.TaskManagementSpecuTest, org.scalajs.testadapter.FingerprintSerializers$DeserializedSubclassFingerprint@79074081, false, [SuiteSelector])
java.util.concurrent.ExecutionException: Boxed Error
	at scala.concurrent.impl.Promise$.resolver(Promise.scala:55)
	at scala.concurrent.impl.Promise$.scala$concurrent$impl$Promise$$resolveTry(Promise.scala:47)
	at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:244)
	at scala.concurrent.Promise$class.complete(Promise.scala:55)
	at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153)
	at scala.concurrent.Promise$class.failure(Promise.scala:107)
	at scala.concurrent.impl.Promise$DefaultPromise.failure(Promise.scala:153)
	at org.scalajs.jsenv.rhino.RhinoJSEnv$AsyncRunner$$anon$1.run(RhinoJSEnv.scala:80)
Caused by: java.lang.OutOfMemoryError: Java heap space

 -----

 Follow up on these:
 * lihaoyi/utest#33 (comment)

*  lihaoyi/utest#42

SemanticBeeng added a commit to SemanticBeeng/play-scalajs-showcase that referenced this issue Feb 3, 2015

wip: evolving tests
Refactored core test logic towards being able to run from uTest as well as Specs2
Moved it to 'shared' to ensure it builds in ScalaJs

Wrote tests same way in uTest but does not run
[jvm] $ +js/test
[info] Setting version to 2.11.2
[info] Set current project to jvm (in build file:/home/nickdsc/projects/playframework-learn/play-scalajs-showcase/)
[info] Compiling 1 Scala source to /home/nickdsc/projects/playframework-learn/play-scalajs-showcase/js/target/scala-2.11/test-classes...
Cleared 1 tasks
[trace] Stack trace suppressed: run last js/test:loadedTestFrameworks for the full output.
[trace] Stack trace suppressed: run last js/test:test for the full output.
[error] Could not run test domain.TaskManagementSpecuTest: org.scalajs.jsenv.ComJSEnv$ComClosedException: JSCom has been closed
[trace] Stack trace suppressed: run last js/test:executeTests for the full output.
[error] (js/test:executeTests) Exception while running JS code: scala.scalajs.runtime.UndefinedBehaviorError: An undefined behavior was detected: ReturnVal(Left(TaskId(1)),Queue(TaskScheduled(Task(TaskId(1),Do this,true)))) is not an instance of scala.util.Try (Lorg_scalajs_testinterface_internal_BridgeBase.sjsir#46)
[error] Total time: 26 s, completed Feb 2, 2015 7:20:18 PM
[jvm] $ last js/test:loadedTestFrameworks
org.mozilla.javascript.JavaScriptException: scala.scalajs.runtime.UndefinedBehaviorError: An undefined behavior was detected: ReturnVal(Left(TaskId(1)),Queue(TaskScheduled(Task(TaskId(1),Do this,true)))) is not an instance of scala.util.Try (Lorg_scalajs_testinterface_internal_BridgeBase.sjsir#46)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1018)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107)
	at org.scalajs.jsenv.rhino.RhinoJSEnv$$anonfun$org$scalajs$jsenv$rhino$RhinoJSEnv$$setupCom$2$$anonfun$4.apply(RhinoJSEnv.scala:285)

 -----
 Why not PhantomJS??

 Follow up on these:
 * lihaoyi/utest#33 (comment)

*  lihaoyi/utest#42

SemanticBeeng added a commit to SemanticBeeng/play-scalajs-showcase that referenced this issue Feb 6, 2015

checkpoint: evolving tests
Refactored core test logic towards being able to run from uTest as well as Specs2
Moved it to 'shared' to ensure it builds in ScalaJs

Wrote tests same way in uTest but does not run
[jvm] $ +js/test
[info] Setting version to 2.11.2
[info] Set current project to jvm (in build file:/home/nickdsc/projects/playframework-learn/play-scalajs-showcase/)
[info] Compiling 1 Scala source to /home/nickdsc/projects/playframework-learn/play-scalajs-showcase/js/target/scala-2.11/test-classes...
Cleared 1 tasks
[trace] Stack trace suppressed: run last js/test:loadedTestFrameworks for the full output.
[trace] Stack trace suppressed: run last js/test:test for the full output.
[error] Could not run test domain.TaskManagementSpecuTest: org.scalajs.jsenv.ComJSEnv$ComClosedException: JSCom has been closed
[trace] Stack trace suppressed: run last js/test:executeTests for the full output.
[error] (js/test:executeTests) Exception while running JS code: scala.scalajs.runtime.UndefinedBehaviorError: An undefined behavior was detected: ReturnVal(Left(TaskId(1)),Queue(TaskScheduled(Task(TaskId(1),Do this,true)))) is not an instance of scala.util.Try (Lorg_scalajs_testinterface_internal_BridgeBase.sjsir#46)
[error] Total time: 26 s, completed Feb 2, 2015 7:20:18 PM
[jvm] $ last js/test:loadedTestFrameworks
org.mozilla.javascript.JavaScriptException: scala.scalajs.runtime.UndefinedBehaviorError: An undefined behavior was detected: ReturnVal(Left(TaskId(1)),Queue(TaskScheduled(Task(TaskId(1),Do this,true)))) is not an instance of scala.util.Try (Lorg_scalajs_testinterface_internal_BridgeBase.sjsir#46)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1018)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107)
	at org.scalajs.jsenv.rhino.RhinoJSEnv$$anonfun$org$scalajs$jsenv$rhino$RhinoJSEnv$$setupCom$2$$anonfun$4.apply(RhinoJSEnv.scala:285)

 -----
 Why not PhantomJS??

 Follow up on these:
 * lihaoyi/utest#33 (comment)

*  lihaoyi/utest#42

SemanticBeeng added a commit to SemanticBeeng/play-scalajs-showcase that referenced this issue Feb 6, 2015

checkpoint: evolving tests
Refactored core test logic towards being able to run from uTest as well as Specs2
Moved it to 'shared' to ensure it builds in ScalaJs

Wrote tests same way in uTest but does not run
[jvm] $ +js/test
[info] Setting version to 2.11.2
[info] Set current project to jvm (in build file:/home/nickdsc/projects/playframework-learn/play-scalajs-showcase/)
[info] Compiling 1 Scala source to /home/nickdsc/projects/playframework-learn/play-scalajs-showcase/js/target/scala-2.11/test-classes...
Cleared 1 tasks
[trace] Stack trace suppressed: run last js/test:loadedTestFrameworks for the full output.
[trace] Stack trace suppressed: run last js/test:test for the full output.
[error] Could not run test domain.TaskManagementSpecuTest: org.scalajs.jsenv.ComJSEnv$ComClosedException: JSCom has been closed
[trace] Stack trace suppressed: run last js/test:executeTests for the full output.
[error] (js/test:executeTests) Exception while running JS code: scala.scalajs.runtime.UndefinedBehaviorError: An undefined behavior was detected: ReturnVal(Left(TaskId(1)),Queue(TaskScheduled(Task(TaskId(1),Do this,true)))) is not an instance of scala.util.Try (Lorg_scalajs_testinterface_internal_BridgeBase.sjsir#46)
[error] Total time: 26 s, completed Feb 2, 2015 7:20:18 PM
[jvm] $ last js/test:loadedTestFrameworks
org.mozilla.javascript.JavaScriptException: scala.scalajs.runtime.UndefinedBehaviorError: An undefined behavior was detected: ReturnVal(Left(TaskId(1)),Queue(TaskScheduled(Task(TaskId(1),Do this,true)))) is not an instance of scala.util.Try (Lorg_scalajs_testinterface_internal_BridgeBase.sjsir#46)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1018)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107)
	at org.scalajs.jsenv.rhino.RhinoJSEnv$$anonfun$org$scalajs$jsenv$rhino$RhinoJSEnv$$setupCom$2$$anonfun$4.apply(RhinoJSEnv.scala:285)

 -----
 Why not PhantomJS??

 Follow up on these:
 * lihaoyi/utest#33 (comment)

*  lihaoyi/utest#42
@nafg

This comment has been minimized.

Copy link

nafg commented Jun 5, 2015

FWIW here's the link to SBT docs on testOptions: http://www.scala-sbt.org/0.13/docs/Testing.html#Options

@lihaoyi lihaoyi referenced this issue Mar 10, 2016

Closed

uTest 0.4.0 #85

21 of 34 tasks complete

@lihaoyi lihaoyi closed this Dec 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment