When I have updated cucumber plugin from V1.2.4[info.cukes] to V.4.2.2[io.cucumber] With the below code, i am getting error, The import cucumber.api.java.en.Given(Or When/Then) cannot be resolved
POM.XML
io.cucumber
cucumber-core
4.2.2
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>6.0.14</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
RunFile from where execution is starting
@RunWith(Cucumber.class)
@CucumberOptions(features = «classpath:features/functional/»,
glue = {«com.jacksparrow.automation.steps_definitions.functional» },
tags = { «@guest_search_in_progress» },
plugin = { «pretty»,»json:target/cucumber-json/cucumber.json»,
«junit:target/cucumber-reports/Cucumber.xml», «html:target/cucumber-reports»},
strict = false,
dryRun = false,
monochrome = true)
public class FunctionalRunCuke {
}
Please suggest, what is the mistake
Я получаю следующую ошибку каждый раз, когда пытаюсь выполнить тест огурца с помощью плагина огурца в Intellij Idea. Я использую следующую версию deaIC-2017.3.5. Я даже попытался установить последнюю версию — ideaIC-2018.2.4 — но проблема все еще сохраняется. Кто-нибудь знает, почему это могло происходить?
Exception in thread "main" cucumber.runtime.CucumberException: Unrecognized plugin: org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter
at cucumber.runtime.RuntimeOptions.addPluginName(RuntimeOptions.java:171)
at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:122)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:84)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:77)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:69)
at cucumber.api.cli.Main.run(Main.java:31)
at cucumber.api.cli.Main.main(Main.java:18)
2 ответа
Лучший ответ
В «Конфигурации запуска / отладки» обновите «Программные аргументы», заменив —plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter на —plugin org.jetbrains.plugins.cucumber.java.run. CucumberJvmSMFormatter
2
Pascal Chardon
19 Окт 2019 в 21:27
Позвольте мне проиллюстрировать, как я столкнулся и нашел способ решить эту проблему.
Раньше я запускал свой файл функций, щелкнув правой кнопкой мыши и запустив в intelliJ. Затем я изменил аргументы программы в конфигурации редактирования для этой конфигурации файла Run XYZ.feature. В этом процессе я удалил аргумент, передающий «org.jetbrains.plugins.cucumber.java.run.CucumberJvm4SMFormatter», и добавил что-то вроде этого «—thread 5».
А потом, когда я закончил, захотелось вернуться к старой конфигурации. Он не запустится и не выдаст эту ошибку. Я подозреваю, что, возможно, аргументы передаются неправильно? В любом случае решение (своего рода взлом) состоит в том, чтобы выбрать другой файл функции ABC.feature и отредактировать конфигурацию для Run ABC.feature и изменить путь к файлу функции на XYZ.feature и ничего больше не менять. Может быть, можно было бы переименовать конфигурацию в Run XYZ2.feature что-нибудь в этом роде. Это работает для меня.
0
Rakesh Horkeri
6 Май 2020 в 20:17
Running a .feature file gives me the following error:
" >....< cucumber.cli.Main --format org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --glue C:/projects/selenium-parent/selenium/src/test/resources/InformationPage.feature
Testing started at 09:20 ...
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy13.feature(Unknown Source)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:108)
at cucumber.runtime.Runtime.run(Runtime.java:94)
at cucumber.runtime.Runtime.run(Runtime.java:82)
at cucumber.cli.Main.run(Main.java:20)
at cucumber.cli.Main.main(Main.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:94)
... 11 more
Caused by: java.lang.NoSuchMethodError: gherkin.formatter.model.Feature.getLine()Ljava/lang/Integer;
at org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter.feature(CucumberJvmSMFormatter.java:89)
... 16 more
Process finished with exit code 1
Empty test suite.
The feature file works if I invoke it via a JUnit test. So what why is it reporting Empty test suite?
Feature: Information Page
Scenario: Has expected components
Given I navigate to the information page
Then I should see the table component
Запуск файла .feature дает мне следующую ошибку:
" >....< cucumber.cli.Main --format org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --glue C:/projects/selenium-parent/selenium/src/test/resources/InformationPage.feature
Testing started at 09:20 ...
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy13.feature(Unknown Source)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:108)
at cucumber.runtime.Runtime.run(Runtime.java:94)
at cucumber.runtime.Runtime.run(Runtime.java:82)
at cucumber.cli.Main.run(Main.java:20)
at cucumber.cli.Main.main(Main.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:94)
... 11 more
Caused by: java.lang.NoSuchMethodError: gherkin.formatter.model.Feature.getLine()Ljava/lang/Integer;
at org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter.feature(CucumberJvmSMFormatter.java:89)
... 16 more
Process finished with exit code 1
Empty test suite.
Файл функций работает, если я вызываю его через тест JUnit. Итак, почему он сообщает Пустой набор тестов?
Feature: Information Page
Scenario: Has expected components
Given I navigate to the information page
Then I should see the table component
2 ответы
Это произошло из-за того, что у меня не был установлен последний плагин огурца-jvm.
Создан 21 ноя.
У меня было
Caused by: java.lang.ClassNotFoundException: org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter
Мне нужно это в пом
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.2</version>
</dependency>
и нужно огурец для джавы плагин установлен
Создан 14 сен.
Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками
intellij-idea
cucumber
cucumber-jvm
or задайте свой вопрос.