Unable to load test resource immediately after clean
See original GitHub issuesteps
- Clone the demonstration repository
- Run
demo.sh
The output we’re seeing is in the README of the demonstration repository.
problem
- When the tests run immediately after a clean, the test fails because the resource can’t be found.
- In subsequent
sbt
executions, the tests pass.
expectation
Code in the test
scope should always be able to load resources from src/test/resources
, whether immediately after a clean or not.
notes
sbt version: 1.0.0 and 1.0.1
Running the demo script with build.properties
setting sbt.version=0.13.16
works as expected.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
java - Junit test fail on maven clean install - load a file in test ...
Your testfile.txt resource is in the right place. This should work unless you have custom Maven resource filtering rules e.g. to exclude .txt ......
Read more >Quickstart: Create and run a load test with Azure Load Testing
This quickstart shows how to create an Azure Load Testing resource and run a high-scale load test for an external website by using...
Read more >Test task unable to locate the resource under target as target ...
Test task is failing. As its unable to find the resource file required (I am trying to load the resource file using ClasspathStoryFinder.class....
Read more >Test fixtures - testthat
and “Who didn't clean up after the dog?”. It's also important that your setup and cleanup is easy to use when working interactively....
Read more >Explore test results | IntelliJ IDEA Documentation - JetBrains
After IntelliJ IDEA finishes running your tests, it shows the results ... on the test execution and why your tests failed or were...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Based on Rafal’s analysis I am going to call it a Specs2 issue.
It seems like this is related to how specs2 works, reasoning:
ClassLoader
in which case the tests will fail. I have not looked into code of specs2, but theirThreadPool
most likely inheritsClassLoader
from the parent thread, in which case it would depend on whatever is the state of the parent thread (which might explain why it sometimes works, and sometimes doesn’t)ContextClassLoader
is valid for the duration of the test, here)