-
Notifications
You must be signed in to change notification settings - Fork 34
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
Simplify unit testing w/ different property values #736
Comments
Maybe these method signatures look like this:
An additional possible feature: Overlay a config file:
This could be done by inserting a loader before the Std PropFile loader. During unit testing, auto-discovery of an AndHowConfig instance is not useful if its possible to specify the entire property state w/ a specific properties file - it would just make it harder to decipher what the configured state is during the test. Thus, I think these annotations should all turn off AndHowConfig discovery. If you are not using these annotations, then it may be useful to auto-discover AndHowConfig to provide a universal config state for testing. Along with turning off AndHowConfig Auto-discovery, this should probably also disable other loaders that make testing sensitive to the environment. Each of the loaders listed below have the potential to override a value that might be configured in the specified properties file and thus should be turned off:
The FixedValue loader should be kept, since it would be handy to override a specific value for a specific test. |
A few more considerations:
Testing Notes
|
Is your feature request related to a problem? Please describe.
Setting up JUnit tests is still somewhat verbose:
Describe the solution you'd like
Create some dedicated test annotations that accept properties files as arguments:
These annotations could be applied to either test classes or individual test methods. The 'Only' method could also shut down the other loaders, perhaps other than the fixedValue loader to allow tests to override individual values.
Describe alternatives you've considered
Method naming could use some consideration.
The text was updated successfully, but these errors were encountered: