BasePlatformTestCase not working

已回答

I have a simple plugin and an simple test, trying to test a simple `AnAction` that I have.

https://github.com/jezzsantos/automate.plugin-rider/blob/main/src/test/java/jezzsantos/automate/plugin/infrastructure/ui/actions/ShowSettingsMenuActionTests.java

But when I run the test it fails with this exception.
Can anyone help me fix this? I have no idea what is broken.

Installation home directory: file:///C:/Projects/github/jezzsantos/automate.plugin-rider/build/riderRD-2022.1
System directory: file:///C:/Projects/github/jezzsantos/automate.plugin-rider/build/idea-sandbox/system-test
Config directory: file:///C:/Projects/github/jezzsantos/automate.plugin-rider/build/idea-sandbox/config-test
Log directory: file:///C:/Projects/github/jezzsantos/automate.plugin-rider/build/idea-sandbox/system-test/log

Following output will be written to a log file C:\Projects\github\jezzsantos\automate.plugin-rider\build\idea-sandbox\system-test\log\frontend.log
[   1775]   WARN - #c.i.n.i.NotificationGroupManagerImpl - Notification group Debugger event log messages is already registered (group=com.intellij.notification.NotificationGroup@4b3ee327). Plugin descriptor: PluginDescriptor(name=IDEA CORE, id=com.intellij, descriptorPath=plugin.xml, path=C:\Projects\github\jezzsantos\automate.plugin-rider\build\riderRD-2022.1\lib, version=221.5080.235, package=null, isBundled=true)
[   1776]   WARN - #c.i.n.i.NotificationGroupManagerImpl - Notification group Rider Remote Debugger: Upload Error is already registered (group=com.intellij.notification.NotificationGroup@5240c0a5). Plugin descriptor: PluginDescriptor(name=IDEA CORE, id=com.intellij, descriptorPath=plugin.xml, path=C:\Projects\github\jezzsantos\automate.plugin-rider\build\riderRD-2022.1\lib, version=221.5080.235, package=null, isBundled=true)
[   1776]   WARN - #c.i.n.i.NotificationGroupManagerImpl - Notification group Xcode settings warnings is already registered (group=com.intellij.notification.NotificationGroup@6e5b3611). Plugin descriptor: PluginDescriptor(name=IDEA CORE, id=com.intellij, descriptorPath=plugin.xml, path=C:\Projects\github\jezzsantos\automate.plugin-rider\build\riderRD-2022.1\lib, version=221.5080.235, package=null, isBundled=true)
[   1776]   WARN - #c.i.n.i.NotificationGroupManagerImpl - Notification group Xamarin launch is already registered (group=com.intellij.notification.NotificationGroup@3f9db1a). Plugin descriptor: PluginDescriptor(name=IDEA CORE, id=com.intellij, descriptorPath=plugin.xml, path=C:\Projects\github\jezzsantos\automate.plugin-rider\build\riderRD-2022.1\lib, version=221.5080.235, package=null, isBundled=true)
[   1777]   WARN - #c.i.n.i.NotificationGroupManagerImpl - Notification group ASP.NET Core Certificate Notifications is already registered (group=com.intellij.notification.NotificationGroup@67e6c19a). Plugin descriptor: PluginDescriptor(name=IDEA CORE, id=com.intellij, descriptorPath=plugin.xml, path=C:\Projects\github\jezzsantos\automate.plugin-rider\build\riderRD-2022.1\lib, version=221.5080.235, package=null, isBundled=true)
[   1815]   WARN - #c.i.i.s.e.StatisticsEventLogProviderUtil - Cannot find event log provider with recorder-id=FUS
[   2182]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR] ERROR: com.intellij.openapi.components.PathMacroManager is registered as application service, but requested as project one
[   2182]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR] java.lang.Throwable: com.intellij.openapi.components.PathMacroManager is registered as application service, but requested as project one
[   2182]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.diagnostic.Logger.error(Logger.java:182)
[   2183]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:638)
[   2183]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:584)
[   2184]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.client.ClientAwareComponentManager.getFromSelfOrCurrentSession(ClientAwareComponentManager.kt:37)
[   2184]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.client.ClientAwareComponentManager.getService(ClientAwareComponentManager.kt:22)
[   2184]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.components.PathMacroManager.getInstance(PathMacroManager.java:26)
[   2185]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.configurationStore.ProjectStoreImpl.<init>(ProjectStoreImpl.kt:47)
[   2185]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.configurationStore.ProjectWithModulesStoreImpl.<init>(ProjectStoreImpl.kt:161)
[   2185]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.configurationStore.PlatformLangProjectStoreFactory.createStore(ProjectStoreImpl.kt:205)
[   2185]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.project.impl.ProjectExImpl$componentStoreValue$1.invoke(ProjectExImpl.kt:59)
[   2186]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.project.impl.ProjectExImpl$componentStoreValue$1.invoke(ProjectExImpl.kt:42)
[   2186]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.concurrency.SynchronizedClearableLazy.getValue(SynchronizedClearableLazy.kt:37)
[   2186]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.project.impl.ProjectExImpl.getComponentStore(ProjectExImpl.kt:117)
[   2186]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.project.impl.ProjectExImpl.getName(ProjectExImpl.kt:93)
[   2187]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.jetbrains.rider.projectView.RiderOpenStrategyProvider.getOpenStrategy(RiderSolutionOpenStrategyProvider.kt:17)
[   2187]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.jetbrains.rider.projectView.SolutionInitializer.beforeProjectLoaded(SolutionInitializer.kt:31)
[   2187]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:642)
[   2188]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:621)
[   2188]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:417)
[   2188]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:391)
[   2188]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:373)
[   2188]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:34)
[   2189]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:180)
[   2189]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at jdk.proxy3/jdk.proxy3.$Proxy42.beforeProjectLoaded(Unknown Source)
[   2189]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.project.impl.ProjectManagerImpl.initProject(ProjectManagerImpl.java:171)
[   2189]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.project.impl.ProjectManagerExImpl.newProject(ProjectManagerExImpl.kt:285)
[   2190]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.project.TestProjectManager.newProject(TestProjectManager.kt:60)
[   2190]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.testFramework.LightPlatformTestCase.initProject(LightPlatformTestCase.java:191)
[   2190]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.testFramework.LightPlatformTestCase.lambda$doSetup$2(LightPlatformTestCase.java:277)
[   2190]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:490)
[   2190]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:523)
[   2191]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.testFramework.LightPlatformTestCase.doSetup(LightPlatformTestCase.java:268)
[   2191]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:42)
[   2191]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$setUp$28(CodeInsightTestFixtureImpl.java:1242)
[   2191]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$1(EdtTestUtil.java:40)
[   2192]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
[   2192]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
[   2192]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
[   2192]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
[   2192]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
[   2193]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
[   2193]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
[   2193]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
[   2193]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
[   2193]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
[   2194]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
[   2194]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[   2194]   WARN - #c.j.r.RiderApplicationLoadListener - [STDERR]     at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

com.intellij.openapi.components.PathMacroManager is registered as application service, but requested as project one
com.intellij.testFramework.TestLogger$TestLoggerAssertionError: com.intellij.openapi.components.PathMacroManager is registered as application service, but requested as project one
    at app//com.intellij.testFramework.TestLogger.error(TestLogger.java:45)
    at app//com.intellij.openapi.diagnostic.Logger.error(Logger.java:182)
    at app//com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:638)
    at app//com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:584)
    at app//com.intellij.openapi.client.ClientAwareComponentManager.getFromSelfOrCurrentSession(ClientAwareComponentManager.kt:37)
    at app//com.intellij.openapi.client.ClientAwareComponentManager.getService(ClientAwareComponentManager.kt:22)
    at app//com.intellij.openapi.components.PathMacroManager.getInstance(PathMacroManager.java:26)
    at app//com.intellij.configurationStore.ProjectStoreImpl.<init>(ProjectStoreImpl.kt:47)
    at app//com.intellij.configurationStore.ProjectWithModulesStoreImpl.<init>(ProjectStoreImpl.kt:161)
    at app//com.intellij.configurationStore.PlatformLangProjectStoreFactory.createStore(ProjectStoreImpl.kt:205)
    at app//com.intellij.openapi.project.impl.ProjectExImpl$componentStoreValue$1.invoke(ProjectExImpl.kt:59)
    at app//com.intellij.openapi.project.impl.ProjectExImpl$componentStoreValue$1.invoke(ProjectExImpl.kt:42)
    at app//com.intellij.util.concurrency.SynchronizedClearableLazy.getValue(SynchronizedClearableLazy.kt:37)
    at app//com.intellij.openapi.project.impl.ProjectExImpl.getComponentStore(ProjectExImpl.kt:117)
    at app//com.intellij.openapi.project.impl.ProjectExImpl.getName(ProjectExImpl.kt:93)
    at app//com.jetbrains.rider.projectView.RiderOpenStrategyProvider.getOpenStrategy(RiderSolutionOpenStrategyProvider.kt:17)
    at app//com.jetbrains.rider.projectView.SolutionInitializer.beforeProjectLoaded(SolutionInitializer.kt:31)
    at app//com.intellij.util.messages.impl.MessageBusImpl.invokeMethod(MessageBusImpl.java:642)
    at app//com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:621)
    at app//com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(MessageBusImpl.java:417)
    at app//com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:391)
    at app//com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:373)
    at app//com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:34)
    at app//com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:180)
    at app/jdk.proxy3/jdk.proxy3.$Proxy42.beforeProjectLoaded(Unknown Source)
    at app//com.intellij.openapi.project.impl.ProjectManagerImpl.initProject(ProjectManagerImpl.java:171)
    at app//com.intellij.openapi.project.impl.ProjectManagerExImpl.newProject(ProjectManagerExImpl.kt:285)
    at app//com.intellij.project.TestProjectManager.newProject(TestProjectManager.kt:60)
    at app//com.intellij.testFramework.LightPlatformTestCase.initProject(LightPlatformTestCase.java:191)
    at app//com.intellij.testFramework.LightPlatformTestCase.lambda$doSetup$2(LightPlatformTestCase.java:277)
    at app//com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:490)
    at app//com.intellij.openapi.application.impl.ApplicationImpl.invokeAndWait(ApplicationImpl.java:523)
    at app//com.intellij.testFramework.LightPlatformTestCase.doSetup(LightPlatformTestCase.java:268)
    at app//com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:42)
    at app//com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$setUp$28(CodeInsightTestFixtureImpl.java:1242)
    at app//com.intellij.testFramework.EdtTestUtil.lambda$runInEdtAndWait$1(EdtTestUtil.java:40)
    at java.desktop@17.0.3/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
    at java.desktop@17.0.3/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
    at java.desktop@17.0.3/java.awt.EventQueue$4.run(EventQueue.java:722)
    at java.desktop@17.0.3/java.awt.EventQueue$4.run(EventQueue.java:716)
    at java.base@17.0.3/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base@17.0.3/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop@17.0.3/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
    at java.desktop@17.0.3/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop@17.0.3/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop@17.0.3/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop@17.0.3/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop@17.0.3/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop@17.0.3/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.Throwable: com.intellij.openapi.components.PathMacroManager is registered as application service, but requested as project one
    ... 48 more
0

Unfortunately, Rider has its own unit testing framework (and uses testNG instead of JUnit), so IntelliJ test infrastructure won't work for Rider.

As an example of such tests, you may take a look at the tests in the AvaloniaRider plugin.

0

Also, regarding the test infrastructure, you may take a look at this PR that introduces tests into the sample plugin.

0

请先登录再写评论。