maximehamm / tzatziki

Cucumber y Tzatziki
26 stars 7 forks source link

Cucumber+ can't run steps from IDE #50

Closed ThomasRichtsfeld closed 6 months ago

ThomasRichtsfeld commented 1 year ago

Hey there 👋

we are using Android Studio Flamingo (Build #AI-222.4459.24.2221.9787799, built on March 21, 2023). Right now we are trying to run Gherkin UI tests from within the IDE. Unfortunately, this is not possible. Neither from the feature file nor from the Cucumber+ panel on the right (see screenshot). It also doesn't seem to recognize the step definitions defined in our Kotlin test files. This is reproducible with the Cucumber demo app

image

Also, we get the following error when running the tests from the pane on the right

java.lang.NoClassDefFoundError: org/jetbrains/plugins/cucumber/java/run/CucumberJavaFeatureRunConfigurationProducer
    at io.nimbly.tzatziki.view.features.nodes.GherkinFileNode.getRunConfiguration(GherkinFileNode.kt:32)
    at io.nimbly.tzatziki.view.features.actions.RunTestAction.runFromTreeNode(RunTestAction.kt:59)
    at io.nimbly.tzatziki.view.features.actions.RunTestAction.runFromEditor(RunTestAction.kt:36)
    at io.nimbly.tzatziki.view.features.actions.RunTestAction.actionPerformed(RunTestAction.kt:28)
    at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:190)
    at com.intellij.openapi.actionSystem.impl.ActionButton.lambda$performAction$0(ActionButton.java:166)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337)
    at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:166)
    at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:465)
    at java.desktop/java.awt.Component.processEvent(Unknown Source)
    at java.desktop/java.awt.Container.processEvent(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:840)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
    at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jetbrains.plugins.cucumber.java.run.CucumberJavaFeatureRunConfigurationProducer PluginClassLoader(plugin=PluginDescriptor(name=Cucumber +, id=io.nimbly.tzatziki, descriptorPath=plugin.xml, path=~/Library/Application Support/Google/AndroidStudio2022.2/plugins/plugin, version=15.3.2, package=null, isBundled=false), packagePrefix=null, instanceId=107, state=active)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:214)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    ... 48 more

We finally found a plugin that can run single scenarios from within the IDE. It would be great if we can get some help with that issue.

Best Thomas

tassilo-posegga commented 1 year ago

Pushing this one. Also running the official Android Cucumber project with the plugin:

java.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation.
    at androidx.test.platform.app.InstrumentationRegistry.getInstrumentation(InstrumentationRegistry.java:45)
    at cucumber.cukeulator.test.KotlinSteps.iOpenComposeActivityWith(KotlinSteps.kt:48)
    at cucumber.cukeulator.test.KotlinSteps.iOpenComposeActivity(KotlinSteps.kt:38)
    at ✽.I open compose activity(file:/Users/tassilo.posegga/Workspace/cucumber-android/cukeulator/src/androidTest/assets/features/extra/compose.feature:4)

I assume that the plugin is designed to work with plain JVM only - and there are some things missing to get it work with Android tests. I'd be happy to contribute if we can get some hints towards what to look into.

maximehamm commented 1 year ago

Hello Do you have the plugin "Cucumber for Java" installed ? This plugin is needed for Cucumber+ to be able to run Java/Kotlin test... May be it is not part of Android Studio... but may be you can install it ?

image
ThomasRichtsfeld commented 1 year ago

@maximehamm Yes, this additional plugin is automatically installed when Cucumber+ gets installed

maximehamm commented 6 months ago

I think your project is not using Java... Cucumber+ works only with Java/Kotlin...

ThomasRichtsfeld commented 6 months ago

@maximehamm we are using the plugin on Android with 100% Kotlin