rkuhn / asynctest Goto Github PK
View Code? Open in Web Editor NEWMinimalistic JUnit-style framework for testing asynchronous components
License: Other
Minimalistic JUnit-style framework for testing asynchronous components
License: Other
It should be possible to state that the n-th percentile execution time of the test method does not exceed a certain value. This must be in addition to checking that none of the executions take longer than the maximum wait time (in order to bound test time). It also means that the test procedure will have to be invoked a large number of times (at least several hundred—also configurable, possibly taking into account warm-up rounds) and this implies that we will also have to limit the number of concurrent invocations to match the expected service capacity.
Consider the following test case:
private def flop = async { assert(false, "this is FALSE") } // <--- SomeTests.scala:14
@Test def two = async {
val x = await(op)
val y = await(flop).toString
val z = await(op)
val w = x + z
y + w
}
Currently the stack trace reported looks like this:
java.lang.AssertionError: assertion failed: this is FALSE
at scala.Predef$.assert(Predef.scala:165)
at com.rolandkuhn.asynctest.SomeTests$$anonfun$com$rolandkuhn$asynctest$SomeTests$$flop$1.apply$mcV$sp(SomeTests.scala:14)
at com.rolandkuhn.asynctest.SomeTests$$anonfun$com$rolandkuhn$asynctest$SomeTests$$flop$1.apply(SomeTests.scala:14)
at com.rolandkuhn.asynctest.SomeTests$$anonfun$com$rolandkuhn$asynctest$SomeTests$$flop$1.apply(SomeTests.scala:14)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
It would be nicer if we could somehow wrap the exception at the line which contains await(flop)
, giving the user a better clue what went wrong.
There should be one annotation to be put on the class and one that can be put onto a test method.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.