在运行功能文件时,我将获得以下异常
线程"main“中的异常: cucumber.runtime.java.JavaBackend.addStepDefinition(JavaBackend.java:164) at cucumber.api.java8.En.Given(En.java:190) at stepdefinitions.steps.(steps.java:16) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)的常数池索引中的错误类型(sun.reflect.NativeCo
你好,我是第一次接触黄瓜和硒。我正在尝试使用多个cucumber功能文件来执行我的maven项目。但是当我做下面的错误时,我得到了。
cucumber.runtime.DuplicateStepDefinitionException: Duplicate step definitions in test_cases.invalid_login.close_browser() in file:/D:/rakesh/folder/neon%20workspace/com.maven.cucum/target/test-classes/ and test_cases.valid_loign.clos
在用Cucumber编码了几年之后,我在尝试执行测试时遇到了奇怪的错误:
Exception in thread "main" java.lang.NoSuchMethodError: org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description;
at io.cucumber.junit.FeatureRunner.ge
3不同的文件详细信息如下-功能文件/运行程序文件和步骤Def文件
@featureTest Feature: Test Facbook smoke Scenario
@Scenario1 Scenario: Test Login with valid Credentials
Given Open chrome and start application
When I enter valid username and valid password
Then User should be login sucessfully
package Runner;
我在学黄瓜。当试图执行黄瓜场景大纲时,我得到了错误。以下是黄瓜特性文件
Feature: to test pages titles
Scenario Outline: to check title of the mutliple pages
Given Open the browser
When navigate to <Link> page
Then check <Title> of the page
Then close the browser
Examples:
| Link | Title
当我用Cucumber运行我的第一个测试文件时,我得到了这个异常,如何解决这个问题?
Exception in thread "main" cucumber.runtime.CucumberException: Error parsing feature file D:/intalled/CucumberConcepts/src/cucumber/features/myfeature.feature
at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:123)
at cucumber.runtime.mode
从Java类运行测试后遇到一些重复错误
我已经尝试更改/更新我的步骤和runner文件,但不幸的是,这并没有帮助解决我的问题。我在黄瓜和maven方面是新手,所以如果我提供的信息较少,请让我知道。
功能文件1:
Feature: Login into account
Existing user should be able to login account using correct credentials
Scenario: Login into account with correct credentials
Given User navigates to stackov
我刚接触Selenium Cucumber,尝试使用Eclipse设置基本Selenium Cucumber JVM,但是当我以JUnit身份运行Testrunner时,注释丢失,并且我需要在步骤定义中手动添加测试步骤。下面是我的特性和JUnit测试运行程序
Feature: Gmail Login
@Scenario1
Scenario: User logs into GMail
Given Open Browser
When Enter gmail link
Then Enter login details
TestRunner.java
package cucumberTest;
我正在尝试将WebElement (而不是字符串)从黄瓜特征文件传递到其相应的步骤定义中。
Scenario: Test
Given I want to click "myWebElement"
相应的步骤定义为:
@Given("^I want to click (.*)$")
public void Test(WebElement we) {
we.click();
}
在运行时,我得到以下跟踪:
cucumber.runtime.CucumberException: Don't know how to con
在将某些Java步骤定义转换为Kotlin后,我得到了“复制步骤定义”。Jenkins将以下步骤定义标识为重复的:
@Given("^that \"([^\"]*)\" is a case in city \"([^\"]*)\" to buy a specific house with code$")
fun theCaseIsACaseInCityToBuySpecificHouseWithCode(caseTag: String, city: String) {
@Given("^that \"([^\
我无法在eclipse中运行我的运行程序文件,因为eclipse说步骤-“用户已经在loginpage上了”在我的特性文件中没有匹配的胶水代码。
另外,当我关闭和打开特性文件eclipse说-一个内部错误发生在:“扫描步骤定义”。java.lang.NullPointerException
运行runner文件时,file将显示以下错误
您可以使用下面的代码片段实现缺少的步骤:
@Given("^User is already on loginpage$")
public void user_is_already_on_loginpage() throws Throwable
在运行Cucumber测试时,使用glue选项有问题。这是我的测试跑步课:
@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/java/com/xcase/tests/cucumber/features/api/APITest.feature",glue={"com.xcase.tests.cucumber.stepdefinitions.api"})
public class APIRunnerTest {
}
我按照以下思路进行测试:
mvn clean test -Dtest=API
尝试使用cucumber/selenium/java/intelliJ运行一个场景,但在其中一个步骤中遇到了关于DataTable的错误。在我开始使用测试运行器并更改了一些东西之前,dataTable工作得很好,并且正确地转换了步骤的参数,但我就是不能让它工作。
这是错误:
cucumber.runtime.CucumberException: Could not convert arguments for step [^I enter the following login details:$] defined at 'Steps.MaStepdefs.iEnterTheFollow
我试图在我的项目代码中使用新的Cucumber库(v4.8.0),并面临特性和步骤定义链接的问题。
我在以前的项目中使用了老版本的Cucumber (v1.2.5)。假设当前项目中的某些设置不正确,我试图匹配上一个项目中的Cucumber依赖项。但我也遇到了同样的问题
我还试图验证我的功能文件中的空格,但是没有成功,定义也没有被识别出来。
My Feature File:
Feature: Feature Test
Scenario: Scenario One
Given Scenario One - Step One
我的定义文件(使用旧的注释类-定义被识别):
p
今天我写了我的第一个Cucumber程序,它失败了。我写了一个非常基本的场景,一个简单的场景,它是步骤定义。以下是特征文件代码和step定义代码。
步骤定义代码:
import cucumber.api.java.en.When;
import cucumber.api.java.en.Then;
public class Testing_Example1 {
@When("^I am on x page$")
public void i_am_on_x_page() throws Throwable {
为测试NG获取一个错误
错误日志:
[Error] java.lang.NullPointerException
at cucumber.api.testng.AbstractTestNGCucumberTests.features(AbstractTestNGCucumberTests.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
我尝试添加Cucumber来测试我的Java项目,我写了一个功能文件:
Feature: I visit the website
Scenario: I read the home page
Given I am on the "home" page
我写了一个运行cukes的类
import cucumber.api.CucumberOptions;
/**
* See https://cucumber.io/docs/reference/jvm#junit-runner
*/
@RunWith(Cucumber.class)
@Cucumb
我突然得到了这个奇怪的异常。我的API测试运行正常。这只是一个简单的放心测试和黄瓜测试。完整的异常日志在下面,我甚至不知道它是从哪里来的,因为它似乎与我的源代码无关。欢迎任何意见。谢谢。 Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/rt/execution/testFrameworks/AbstractExpectedPatterns
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.b