Load files and mappings from src/test/resources by default#184
Conversation
|
Hey @oleg-nenashev , I decided to give this ticket a try. I believe it would be a good idea to allow the root directory to be customizable as well but I thought about getting some feedback and suggestions to ensure I'm on the right track. Thanks! I see some unintended formatting changes as well, maybe I could add a PR to include spotless to the project same as the main wiremock project? |
|
@lhcopetti thank you for the pull request, I will take a look Regarding spotless, I do not plan to include the same configuration as in WireMock core as it is overly prescriptive and damaging to contributor experience. I do not mind if there are some reasonable refactorings along with the pull requests, the flow of contributions is not that high to worry about merge conflicts. Some basic rules from spotless could be introduced though |
|
Path definitely needs to be configurable. The most obvious example being |
ab206b7 to
3eacf3a
Compare
|
Hey @oleg-nenashev @mplanchant . I updated the PR to add the configurable rootDir option. Please let me know if that makes sense. Thanks! |
oleg-nenashev
left a comment
There was a problem hiding this comment.
LGTM, and thanks for the update!
|
If this is merged and released, I'm happy to try it out. |
This PR adds support for loading files and mappings from test resources directory.
By default, It will look into
src/test/resources/mappingsandsrc/test/resources/__filesbehaving very similarly to whenWireMockServeris started programmatically. This path can be configured viawithRootDir(File file).This addition simplifies the testing setup by providing an alternative to having to map all stub and file paths individually using
with...()calls.Before:
After:
Make sure all stubs and files are stored in the proper sub-directories and all the manual inclusions may be removed:
Alternatively, one can choose a different path to load mappings/files from:
References
Submitter checklist
#help-contributingor a project-specific channel like#wiremock-java