Thank you for the clear and well organized walk through. Excellent demo on how to slice up tests, use auto injection to reduce clutter and provide default values for command line options. So happy to see people thinking beyond just getting it working, but also make it elegant. Tests commonly get swept under the rug, you've shown how to take them to the next level!
@MVPJava7 жыл бұрын
Thanks +Tom, nice to be appreciated!
@chiruroyal3944 жыл бұрын
It's very useful thanks a lot.please provide the git link to download the source code
@chronpwn27777 жыл бұрын
Thank you for the guide. What is your opinion on the @ActiveProfiles annotation? This enables the all the integration tests to be ran with one command, rather than having to run separate unit test commands with different profiles. I understand that this is not a problem in continuous integration environments. I also read that you can create Test Suites, which to my understanding can provide similar functionality to @IfProfileValue, by grouping all embedded tests under one Test Suite. Please let me know your thoughts on this subject. Thanks for reading.
@MVPJava7 жыл бұрын
Hi +Chronpwn, There are 2 reasons why I didn't go solely with @Profile and @ActiveProfiles. 1. The majority of tutorials you find on KZbin cover just that and so its really boring that nothing new is out there; status quo stuff which I'm not interested in following. I wanted to put something out that was different and maybe gave you a new way to think about it (if that use case applies to you). 2. @ActiveProfiles ("it") is a bit misleading at face value. It doesn't run you tests IF that profile ("it") is activated by you but rather activates all your registered Spring @Beans with the "it" profile for you automatically whether you want to or not; you don't get a choice. It forces activation of those beans. What if you don't want that? That is what I was trying to address. My opinion of @ActiveProfiles is that its just fine if you want to run your integration tests with a specific @Profile all the time. In my case, I didn't want to force it with the same @Profile all the time and wanted to have the flexibility to either run scaled down OR scaled up IT tests with different @Profiles. Maybe I wanted to run a very quick test (thus "it-embedded") every hour or maybe I was going out to lunch/coffee and decided to run with "it" for a more realistic longer running IT test. I unfortunately have not tried this option yet with separate Test Suites but I'm sure it could be possible as well. It would be very interesting to go an investigate this path; possibly another tutorial?!. Sometimes you may not have different Test Suites, I have seen this. Thanks for you question Chronpwn, Andy