У меня есть тестовый пример, использующий Cucumber + JUnit, и он работает правильно. Но затем я изменил его для работы с TestNG, и сценарий ios не найден. Когда я выполняю в Eclipse тест с TestNG (Run as -> TestNG Test), я получаю это сообщение:
[RemoteTestNG] обнаружен TestNG версия 7.0.1 от 14, 2020 13:36:06 PM io.cucumber.testng.TestNGCucumberRunner ADVERTENCIA: По умолчанию Cucumber работает в режиме --non-строгий. Это значение по умолчанию изменится на --strict, а --non-strict будет удалено. Вы можете использовать --strict или @CucumberOptions (strict = true), чтобы подавить это предупреждение. / cucumber / testrunner
0 Scenar ios 0 Steps 0m0,000s
Мне показалось странным, что он говорит:
РЕКЛАМА: Функции не найдены в classpath: / com / other / cucumber / testrunner
Пока мой класс бегуна настроен на поиск файлов .feature в com / other / cucumber / feature, как вы можете видеть ниже:
com.other.cucumber.testrunner.CucumberIntegrationTest
@RunWith(Cucumber.class)
@CucumberOptions(
features = "classpath:com/other/cucumber/feature",
glue="com.other.cucumber.stepdefinition",
tags = {"@RegressionTest"},
plugin = { "pretty",
"html:target/cucumber/concatTest",
"json:target/cucumber/concatTest.json"})
public class CucumberIntegrationTest extends AbstractTestNGCucumberTests {
}
Файл .feature помещается в src / test / resources / com / other / cucumber / feature и находится по адресу JUnit (когда выполняется JUnit), но не найден TestNG.
TestNG. xml
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1" >
<test name="Nopackage">
<classes>
<class name="com.other.cucumber.testrunner.CucumberIntegrationTest" />
</classes>
</test>
</suite>
pom. xml
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
После большого количества проб / ошибок я заставил его работать с TestNG, но мне пришлось понизить версию моего Cucumber de Отклонения от текущих io.cucumber
до прежних info.cukes
:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.4</version>
</dependency>
Что мне нужно для запуска последних версий Cucumber с TestNG?