Comments (3)
from scalatest-junit-runner.
Hi Gabriel,
I just checked what is going on with this issue. As far as I understand it, this problem falls outside of the scope of the test runner.
The foreach
function catches all exceptions and reports them to the execution context. In the javadoc it is described as
Since this method executes asynchronously and does not produce a return value, any non-fatal exceptions thrown will be reported to the ExecutionContext.
The default handler prints a stack-trace but otherwise does nothing else. The type of the ExecutionContext
used determines how this error will be handled. Also because of the async execution of the lambda of the foreach
, the test itself already finishes with success when the assertions are running.
I think using foreach
is not the best approach because of how the error is handled. I am not sure if this is the best solution, but using map
instead of foreach
and waiting on the result of the assertions broke the test when the assertion did break:
test("should fail future") {
val future = Future {
1
}
Await.result(
future.map({ r =>
r should ===(2)
}),
Duration.Inf)
}
Let me know if you find anything else to handle these assertions.
Best,
Gyuri
from scalatest-junit-runner.
After closer examination, I realize that assertions inside of a future.foreach
is a definite code smell. Somehow Intellij is able to see the TestFailedException
even though it was thrown in some other thread and mark the test failed anyway.
from scalatest-junit-runner.
Related Issues (20)
- Test discovery breaks when running into classes/objects which are not valid Tests HOT 1
- Support discovery of suites with failed initialization by `UniqueId` HOT 4
- test extending BeforeAndAfterAll does not run beforeAll() and afterAll()
- Tests not extending from scalatest classes are not discovered
- Wrong JUnit reporting makes failed test to be treaded as passing HOT 8
- MalformedClassName exception during discovery
- Specifying reporters HOT 9
- Exception-induced RunAborted event is not reported as fail
- Kotlin DSL example HOT 1
- RunAborted events are not reported HOT 3
- Nested tests represented as properly nested rather than individual tests HOT 1
- Correctly handle Scalatest TagAnnotations HOT 1
- Scala 3 support
- tag filtering ignores "failed to init" test classes HOT 5
- Test suite throws "org.junit.platform.commons.PreconditionViolationException: The discover() method for TestEngine with ID 'scalatest' returned a cyclic graph." error HOT 10
- Can we add support for running tests in parallel? HOT 1
- scalatest-junit-runner does not work with Gradle Test Distribution HOT 5
- Tests do not run when using maven-surefire-plugin version 3.0.0-M7 HOT 5
- Add support for UniqueId selectors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalatest-junit-runner.