When testing a plugin for IntelliJ-based IDEs using a UI test, the plugin gets to operate within a fully-featured instance of the IDE. Most tests will therefore require a project to perform their actions on. This opens a question: How do you deal with modifications to test projects made by tests? Add undo logic at the end of every test? Revert using a version control system? Those options sound like easy ways to make new mistakes.
We faced the same problem when writing tests for our own plugin, Symflower for IntelliJ IDEA and GoLand, but we've opted for a simpler solution. We don't run tests on the canonical source of our test projects but rather copy the entire project directory and use that copy instead. This avoids relying on repetitive cleanup logic or VCS-based reverting that could undo legitimate changes to the source files.
Curious about how we do it? Head over to Symflower's blog to read the rest of this article:
Isolating IntelliJ plugin tests using temporary project directories
Top comments (0)