Plugin to run Junit tests on external server

已回答

I'm trying to write a plugin that will allow me to run JUnit tests on an external server, to give some contexts these are more for integration tests that rely on the running server and many resources which I can't import into the IDE. The server already has a "test" app that where these tests can be run and it works great.  

I've created an external library that can communicate with the server by http. My API is very simple, it's one method that takes a DTO as an argument which contains the test suite name and individual test cases. This all works very well and will return a result with all passing/failing tests and error/output for failures.

So I want to add an action on context menu in test classes, like by default you have "Run <test>" and "Debug <test>". I want to add a "Run <test> on server...".

Then tests will run, and when I get the result, I want to show it in IntelliJ like the way JUnit results are shown.

At some point I'll have to figure out how to specify a server URL, but for a first version I'll hardcode (it's 99% of the time going to be http://localhost:9001 so not critical, but definitely if I get it working, that will be a next step). 

I'm a complete newbie for IntellIJ plugin development, I've looked at some tutorials, and will probably keep trying stuff, but any pointers/suggestions on where to begin with this would be much appreciated. 

Thanks.

0

I'd suggest to start with https://github.com/JetBrains/intellij-sdk-docs/blob/master/tutorials/run_configurations.md. Then you would need providers which would create those configurations for you, look at com.intellij.execution.testframework.AbstractInClassConfigurationProducer, I guess it should work well for you.

Then you would need to create a UI for the tests. I guess it could be similar how import from history works: com.intellij.execution.testframework.sm.runner.history.ImportedTestContentHandler - it generates events like normal tests do from serialized stream. The corresponding runnable state is com.intellij.execution.testframework.sm.runner.history.ImportedTestRunnableState. 

Anna

0
Avatar
Permanently deleted user

Thanks a lot Anna, this is very helpful :) I'll take a look at that. 

0

请先登录再写评论。