Hey <@U3JDL750W>! Thanks to its mention on the <ap...
# http4k
l
Hey @s4nchez! Thanks to its mention on the approval testing docs page my team has been using
org.http4k:http4k-testing-approval
in conjunction with your Okey-doke plugin for a couple months now. The tool + plugin has definitely a huge improvement over renaming the generated files manually, but now that we've been living with the process for a while a few DX issues have surfaced: 1. It's hard to know if the keyboard shortcut (Ctrl + F11) worked. You have to have the cursor focused in the right place. Precise placement in the editor on the test or in the project viewer on the file both work, but (perhaps unintuitively) the test execution's run window/console does not work. And there's no visual indication if it worked, beyond navigating to the file in the project viewer. As a result I've noticed we just hit Ctrl + F11 obsessively in every window "just to make sure." 2. When we rename tests, the generated approval files get abandoned. We often don't notice initially, and only after some time notice when there's many more approval files than tests. The process to clean up the clutter is tricky. We usually make sure all our tests are passing, commit, delete all the approval files, rerun tests, approve all the approval files, and commit again. But this is a little error-prone and tedious. When we only had 1-20 tests, these weren't big issues. But now that we're in the 100s it's painful enough issue we're looking to address it. Thought we'd check with the community here. Can anybody recommend any better ways to work with
org.http4k:http4k-testing-approval
that we might have missed?
d
Idea plugins can be a struggle - the idea APIs aren't great to integrate with and I've also found it quite inconsistent at times. For the approval files - this has always been a problem. It might be possible to modify the junit extension to identify orphaned files and flag them if they aren't used. But in the case a test file is renamed then I'm not sure how we could do this without writing a ksp compiler plugin (feel free to try!) Occasionally, I run a process where I delete all of the approval files in a clean (passing) source tree, run the build (fails) and then run a command to rename all of the actual files to .approved. this generally picks up any stray orphans.
๐Ÿ†’ 2
s
> no visual indication if it worked There should be a
Approved n tests
info in the status bar after approving. It shouldn't be too hard to turn that into notification to make it more prominent. Re: shortcut not working in some contexts, I suspect it's because the shortcut only works when there's something selected to approve (i.e. there's no global, context-independent approval action)
generated approval files get abandoned
The method David described (make sure all passes, remove all files, run all tests and approve them again) is the only guaranteed to work. The plugin does not understand how those files are generated (that's why it works with multiple approval libraries, as long as they generate .approve and .actual files). The only thing that perhaps it could do is look at file update timestamps, but even that feels like is likely to be flaky.
l
Thanks for the insight and ideas. Based on @s4nchez's message, I'm suspicious that we might not be seeing the same things, so I made a quick screen recording to demonstrate. Even if there's nothing easy or feasible to improve here, I really appreciate you guys taking the time to take a look and reply. http4k โค๏ธ
s
I've added the status bar thing in the first version, so it may have been lost over time ๐Ÿ˜ž The "approve from the diff" issue is a known one, unfortunately ๐Ÿ˜ž I briefly looked into adding the action to that view, but couldn't find the integration point in the IDE (developing plugins requiring learning a lot of IntelliJ's source code, which is not ideal) Selecting+approving multiple files is a reasonable assumption, so I take that as a bug. Thank you for such a thorough feedback in the video! My time is somewhat limited in the coming weeks to commit to improving those, but this kind of interaction gives me a boost of motivation to keep improving the plugin ๐Ÿ™‚
๐Ÿ™Œ๐Ÿป 1
l
Cool @s4nchez! Even in the current state the plugin's super helpful and appreciate the work that's gone into it. Totally understand you may or may not have time to dig into these things soon, but if you do, you can definitely count on us for feedback on any updates.
๐Ÿ‘ 1
๐Ÿ™ 1