JetBrains / la-clojure

Clojure plugin for IntelliJ IDEA
Apache License 2.0
220 stars 49 forks source link

'AllTests' run configuration just ignores lots of test classes #71

Closed hsestupin closed 10 years ago

hsestupin commented 10 years ago

I've set up project according to your guide.

If I choose 'AllTests' configuration and run it than only some of all test classes will be used during the run. To be more precisely test suite consists of only 5 classes:

But definitely there are many other test classes, e.q. BarfBackwardsTest, ClojureResolveSymbolTest and so on.

If I run ClojureResolveSymbolTest as a single test with junit configuration which is the same as in AllTests it fails with strange exception: java.lang.NoClassDefFoundError: Could not initialize class com.intellij.openapi.vfs.LocalFileSystem$LocalFileSystemHolder at com.intellij.openapi.vfs.LocalFileSystem.getInstance(LocalFileSystem.java:46) at com.intellij.testFramework.PlatformTestCase.cleanupApplicationCaches(PlatformTestCase.java:341) at com.intellij.testFramework.LightPlatformTestCase$8.run(LightPlatformTestCase.java:666)

Please tell me what I am doing wrong cause this problem blocks me to send some useful pull requests.

p.s. My .idea/ config doesn't differ to the repo one. Thanks.

Alefas commented 10 years ago

For creating new tests you should configure defaults like in 'AllTests'. As for 'AllTests' configuration it looks weird, all tests should be available.

hsestupin commented 10 years ago

The situation could be cleared up if somebody from the side could approve described problem exists. I've also verified that my $PROJECT$/out/artifacts/Clojure folder contains all Test classes presented at source code. Dont know what's wrong with it. I use the latest 12 IDEA Community Edition.

hsestupin commented 10 years ago

So suddenly it becomes working for me. Have no idea what happened but guess it's difficult to reproduce so you could close it if you want.

hsestupin commented 10 years ago

AllTests configuration runs well but ClojureResolveSymbolTest is still failing while junit default is set like in AllTests. The problem is 100% reproduced if your junit default config is EXACTLY like in AllTests. And here is why.

After some time spent in debugging I've figured out that problem is that during ClojureResolveSymbolTest run system property idea.platform.prefix is NOT passed to jvm. And as a result Idea Core plugin is not initialized in method PluginManagerCore.loadDescriptorsFromClassPath()

But when AllTests config is executed there exist test classes which extend LightCodeInsightTestCase. Since inside the protected constructor of LightCodeInsightTestCase method IdeaTestCase.initPlatformPrefix(); is called than Idea Core plugin is initialised properly.

Hope this explanation does make sense to you. p.s. My plugin IDEA13SDK version is idea/131.179.

Fix is pretty simple. To repair ClojureResolveSymbolTest you just have to add -Didea.platform.prefix=Idea to you junit default config.

Alefas commented 10 years ago

Looks weird, but anyway thank you for explanation.