Setup completition provider in the LightPlatformCodeInsightFixture4TestCase

I want to test my completition provider. How do I set it up in TestFixture -

LightPlatformCodeInsightFixture4TestCase

It looks like SDK test framework does not use plugin.xml

0
6 comments

Please describe the problem in detail. Did you double-check the classpath you're running the test with?

0

I ran my test from Intellij, it takes care about classpath

Here is the test 

class LibDependencyCompletionProviderTest : LightPlatformCodeInsightFixture4TestCase() {
val configurationWithFrameworkAndPlatform =
"""[env:uno]
platform = atmelavr
board = uno
framework = 'arduino'
lib_deps ="""

@Test
fun testAutoCompleteForLibraryWhenFrameworkAndPlatformExists() {
myFixture.configureByText(PlatformIO.INI, configurationWithFrameworkAndPlatform)
val editor = myFixture.editor
editor.caretModel.currentCaret.moveToVisualPosition(VisualPosition(5, 11))
val arrayOfLookupElements = myFixture.complete(CompletionType.BASIC, 1)
assertFalse(arrayOfLookupElements.isEmpty())
}
}

 

The class that extends CompletionContributor is in the same package and is in the classpath. This provider configured in plugin.xml. But it does not look like plugin.xml is even used by testing framework, because I intentionally made an error in xml and test failed for exact same reason.

 

So the question is how do I configure and unit test my Competition provider?

 

0

What happens when you rename plugin.xml to nothing.xml? Does it work if you extend from BasePlatformTestCase instead? How do you setup your project?

0

The same happens in both cases.

 

My project is a gradle project. It was created from Intellij

0

I also checked out original project that is used for this tutorial - https://www.jetbrains.org/intellij/sdk/docs/basics/testing_plugins/test_project_and_testdata_directories.html

 

If I comment out

<completion.contributor language="Simple" implementationClass="com.simpleplugin.SimpleCompletionContributor"/>

in

https://raw.githubusercontent.com/JetBrains/intellij-sdk-docs/master/code_samples/simple_language_plugin/resources/META-INF/plugin.xml

com.simpleplugin.SimpleCodeInsightTest#testCompletion test is still green. So it is not clear what this test is actually testing and how this Intellij SDK test framework actually works.

 

 

0

(1)

<completion.contributor language="Simple" implementationClass="com.simpleplugin.SimpleCompletionContributor"/>

is not used in com.simpleplugin.SimpleCodeInsightTest#testCompletion as it tests completion in Java file CompleteTestData.java, not completion from SimpleCompletionContritor operating in "Simple" language only

(2) could you provide ZIP or source repository of your plugin to reproduce the problem? Thanks

0

Please sign in to leave a comment.