Cannot run individual unit test classes

Issue #170 resolved
Michael Hoefer created an issue
  1. Edit (or create) a Run/Debug Config, for apex unit tests
  2. Deselect all tests, then select one. (Or don't select anything. The behavior is the same.)
  3. Click OK. (Or click Apply first - makes no difference)
  4. Edit the same Run/Debug Config again. Observe that your settings are still intact. Just the one test class is still selected. Good. Click OK.
  5. Edit the same Run/Debug Config again.
    Result: your settings are lost. All tests are selected again.

OR more simply:

  1. Create a Run/Debug config, select only one class, click OK.
  2. Run said config.
    Result: all tests execute. If you open the config again, all tests are selected.

Comments (12)

  1. Scott Wells repo owner

    Michael, I just ran through these steps and wasn't able to reproduce the issue. The results of step 5 were identical to the results of step 4 with just the one test class selected. I trust that this is happening to you, of course! Falling back on my favorite question, is there anything useful in idea.log when this happens? Just trying to figure out what might be contributing to the behavior.

    I'll also try this with a couple of my other orgs that have significantly more unit test classes and let you know if I'm able to reproduce it successfully.

  2. Michael Hoefer reporter

    Lovely. I should have mentioned that no, I checked the log and it showed nothing new logged while stepping through the above.

    There is a host of error messages when opening the project, but they are not necessarily related:

    2015-11-27 09:53:47,436 [ 31850] ERROR - stubs.StubProcessingHelperBase - IdeaLoggingEvent[message=PSI and index do not match, throwable=Please report the problem to JetBrains with the file attached file=Apex(DashboardComponentSnapshot.cls), file.class=class com.illuminatedcloud.intellij.filetype.ApexClassFile, file.lang=Language: Apex, modStamp=0 AST INCONSISTENT, perhaps after incremental reparse; Apex(DashboardComponentSnapshot.cls) stub debugInfo=created in getStubTree(), no AST; with backReference document before=null latestIndexedStub=StubTree{myDebugInfo='created from index; with backReference', myRoot=ApexClassFileStub}1409926573 same size=true debugInfo=created from index; with backReference viewProvider=SingleRootFileViewProvider{myVirtualFile=jar:///Users/michael/Code/CPQ/IlluminatedCloud/Dev_Org/OfflineSymbolTable.zip!/ConnectApi/DashboardComponentSnapshot.cls, content=VirtualFileContent{size=726}} viewProvider stamp: 0; file stamp: 0; file modCount: 1448575588000; file length: 726 doc saved: true; doc stamp: 0; doc size: 724; committed: true in many projects: false indexing info: indexed at 1448575588000 with size 724 java.lang.Throwable at com.intellij.psi.impl.DebugUtil.currentStackTrace(DebugUtil.java:497) at com.intellij.psi.stubs.StubProcessingHelper.stubTreeAndIndexDoNotMatch(StubProcessingHelper.java:43) at com.intellij.psi.stubs.StubProcessingHelperBase.a(StubProcessingHelperBase.java:172) at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:154) at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:52) at com.intellij.psi.stubs.StubIndexImpl$1.process(StubIndexImpl.java:231) at com.intellij.psi.stubs.StubIndexImpl$StubIdListContainerAction.perform(StubIndexImpl.java:582) at com.intellij.psi.stubs.StubIndexImpl$StubIdListContainerAction.perform(StubIndexImpl.java:570) at com.intellij.util.indexing.ValueContainer.forEach(ValueContainer.java:81) at com.intellij.psi.stubs.StubIndexImpl.a(StubIndexImpl.java:252) at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:223) at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:212) at com.intellij.psi.stubs.StubIndex.process(StubIndex.java:77) at com.intellij.psi.stubs.StubIndex.process(StubIndex.java:96) at com.intellij.psi.stubs.StubIndexImpl.get(StubIndexImpl.java:201) at com.intellij.psi.stubs.StubIndexImpl.get(StubIndexImpl.java:191) at com.intellij.psi.stubs.AbstractStubIndex.get(AbstractStubIndex.java:39) at com.illuminatedcloud.intellij.index.AbstractApexDeclarationStubIndex.get(SourceFile:28) at com.illuminatedcloud.intellij.index.AbstractApexDeclarationStubIndex.findDeclaration(SourceFile:34) at com.illuminatedcloud.intellij.index.ApexDeclarationShortNameIndex.getDeclarations(SourceFile:80) at com.illuminatedcloud.intellij.psi.impl.ApexSystemRunAsStatementMixin.getSystemRunAsDeclarations(SourceFile:114) at com.illuminatedcloud.intellij.psi.impl.ApexSystemRunAsStatementMixin.access$000(SourceFile:36) at com.illuminatedcloud.intellij.psi.impl.ApexSystemRunAsStatementMixin$1.doGetReferences(SourceFile:78) at com.illuminatedcloud.intellij.psi.impl.PsiReferenceCache$1.compute(SourceFile:64) at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:136) at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49) at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222) at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:66) at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38) at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:84) at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:132) at com.illuminatedcloud.intellij.psi.impl.PsiReferenceCache.getReferences(SourceFile:58) at com.illuminatedcloud.intellij.psi.impl.ApexSystemRunAsStatementMixin.getReferences(SourceFile:55) at com.illuminatedcloud.intellij.editor.IlluminatedCloudSyntaxAnnotator.annotate(SourceFile:74) at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.a(DefaultHighlightVisitor.java:162) at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:103) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:354) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$100(GeneralHighlightingPass.java:65) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$3.run(GeneralHighlightingPass.java:288) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:308) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.access$200(GeneralHighlightingPass.java:65) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass$4.run(GeneralHighlightingPass.java:314) at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:87) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:311) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.a(GeneralHighlightingPass.java:280) at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:219) at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:82) at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:67) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1$1.run(PassExecutorService.java:444) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1169) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1.run(PassExecutorService.java:435) at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:446) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(PassExecutorService.java:432) at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:408) at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:206) at jsr166e.ForkJoinTask.doExec(ForkJoinTask.java:260) at jsr166e.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:858) at jsr166e.ForkJoinPool.scan(ForkJoinPool.java:1687) at jsr166e.ForkJoinPool.runWorker(ForkJoinPool.java:1642) at jsr166e.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:108) ]

  3. Michael Hoefer reporter

    So Scott, I just tried the same thing on a different project of ours, a smaller extension package, and it worked fine.

    So, yes it could be a scaling issue. Our main package has 113 test classes, somewhere over 400 test methods. The other extension package only has five or so. I'd be surprised if that was the issue, though. I'm thinking it is more likely a corruption elsewhere, or a problem with the org itself, somehow. I'm going to try on a different branch with a different org.

  4. Scott Wells repo owner

    Michael, the error message above may well be related since it's referencing issues in the stub index. Can you rebuild indices (Settings>Illuminated Cloud (<connectionName>)>Rebuild) and allow the IDE to restart and see if the problem still persists?

  5. Michael Hoefer reporter

    That didn't help. The error in the log is gone, but the behavior remains. Nothing is sent to the idea.log at all. There is something odd about this project, but it is impossible to tell what, without setting a breakpoint in your code :|

  6. Michael Hoefer reporter

    Hey again Scott. So, good-ish news here. I just tried the nuclear option, and it seems to have worked. I:

    1. Quite IDEA
    2. Deleted .idea and *.iml and IlluminatedCloud
    3. Restarted IDEA.
    4. Used File => Open and selected my root directory.
    5. Your plugin detected the .cls files and correctly auto-setup (sweet, btw)
    6. I added an org, retrieved namespace, retrieved package, but did not yet build the OST. Then I created the Run/Debug config, and it worked as expected.

    I'm building the OST now, though hard to imagine that would cause any trouble. Hopefully this was somehow a remnant from an older project format. I hadn't recreated it like this since you went from library to SDK, though of course I'd already swtiched it to the SDK setup as there was no other option. Mystery unsolved...

  7. Michael Hoefer reporter

    This seems to have gone away after recreating the IDEA project from scratch and letting IlluminatedCloud detect and set itself up again.

  8. Scott Wells repo owner

    Okay. Sorry you had to do that. There are enough of these little issues that are magically resolved through project/module recreation and/or rebuilding indices at this point that I'm going to spend some time seeing what I can do to detect the situations proactively and guide the user through a resolution. Thanks for following up!

  9. Log in to comment