Skip to content
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

Make new SpringBoot Test "args" support properties resolution and take part of the context hierarchy id #20865

Closed
nightswimmings opened this issue Apr 7, 2020 · 2 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@nightswimmings
Copy link

I think args should behave like properties and allow something like @SpringBootTest(args = "--myargfoo=${test.foo.value}").

Besides, it looks like arg is not considered as context id in order to tell whether reuse the context or not across tests. I had to hack it with a dup like @SpringBootTest(args = "--myargfoo=NValue", property="NValue"). Otherwise context behave as if all tests with diff arguments were the same context (bare @SpringBootTest)

@wilkinsona
Copy link
Member

Thanks for the suggestion. Property placeholder replacement cannot be performed automatically for application arguments as they are passed to the application before the Environment has been created. For example, when running your application normally, they will be passed directly to its main(String[] args) method. To align testing support with the behaviour at runtime, it's important for @SpringBootTest to treat arguments in the same way.

Besides, it looks like arg is not considered as context id in order to tell whether reuse the context or not across tests.

I think this is a bug. Thanks for bringing it to our attention. I've opened #20866 so that we can fix it.

@wilkinsona wilkinsona added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 7, 2020
@snicoll snicoll changed the title Enhancement: Make new SpringBoot Test "args" support properties resolution and take part of the context hierarchy id Make new SpringBoot Test "args" support properties resolution and take part of the context hierarchy id Apr 7, 2020
@nightswimmings
Copy link
Author

You are amazing guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants