cucumber 相关问题

Cucumber是一种行为驱动开发(BDD)工具,它以纯文本(以简单的Gherkin语言结构)编写的功能描述作为自动化测试。

在 Selenium 中实现 LoadableComponents 时如何更好地处理所需 PageObject 的创建?

我正在学习使用 Selenium、Cucumber 和 Java 进行自动化测试,并且我已经实现了页面对象模型设计模式。除此之外,我还实现了 LoadableComponents 模式...

回答 1 投票 0

在 mvn 测试之后,由于某种原因我看到“测试运行:0”

我正在尝试使用“maven test”运行我的测试,但我总是收到测试运行:0,失败:0,错误:0,跳过:0 找不到问题所在。我猜问题出在 eather pom 或 runner 上 茹...

回答 1 投票 0

Typescript/cypress-cucumber-preprocessor:用动态示例编写场景大纲

我的问题与此非常相似:Behave:用动态示例编写场景大纲。不同的是我不使用Python。我用 Cypress 处理我的 Gherkin 场景(通过

回答 3 投票 0

在类路径中找不到功能:/cucumberOptions

我正在创建一个使用 cucumber、junit 和 TestNG 的自动化项目。 我的POM文件如下: 我正在创建一个使用 cucumber、junit 和 TestNG 的自动化项目。 我的POM文件如下: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>main.project</groupId> <artifactId>project</artifactId> <version>0.0.1-SNAPSHOT</version> <name>project</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>7.3.0</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.5</version> </dependency> <!-- https://mvnrepository.com/artifact/com.aventstack/extentreports --> <dependency> <groupId>com.aventstack</groupId> <artifactId>extentreports</artifactId> <version>5.0.5</version> </dependency> <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit --> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-junit</artifactId> <version>6.9.0</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java --> <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java --> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-java</artifactId> <version>6.9.0</version> </dependency> <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng --> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-testng</artifactId> <version>6.9.0</version> </dependency> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-java8</artifactId> <version>6.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> <configuration> <suiteXmlFiles> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> <plugin> <artifactId>maven-site-plugin</artifactId> <version>3.7.1</version> </plugin> <plugin> <artifactId>maven-project-info-reports-plugin</artifactId> <version>3.0.0</version> </plugin> </plugins> </pluginManagement> </build> </project> 我还创建了一个新的 cucumberTestNG.xml 文件 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd"> <suite name="Suite"> <listeners> <listener class-name = "project.Listeners"/> </listeners> <test name="Validate User Login"> <classes> <class name="cucumberOptions.TestRunner"/> </classes> </test> </suite> 我的测试运行者: package cucumberOptions; import org.junit.runner.RunWith; import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions; import io.cucumber.testng.AbstractTestNGCucumberTests; //@RunWith(Cucumber.class) @CucumberOptions( features = "src/test/java/features", glue = "stepDefinitions") public class TestRunner extends AbstractTestNGCucumberTests { } 如果我使用 TestNG Suite 运行 cucumberTestNG 文件,则会收到以下错误: Dec 09, 2020 9:16:16 PM io.cucumber.testng.TestNGCucumberOptionsProvider warnWhenJUnitCucumberOptionsAreUsed WARNING: Ignoring options provided by io.cucumber.junit.CucumberOptions on cucumberOptions.TestRunner. It is recommend to use separate runner classes for JUnit and TestNG. Dec 09, 2020 9:16:16 PM io.cucumber.core.runtime.FeaturePathFeatureSupplier get WARNING: No features found at classpath:/cucumberOptions 文件夹结构: 我的环境变量中有Java和Maven 我查看了诸如 cucumber jvm CucumberException: No features found at [] 之类的问题 并确保我的正确性用黄瓜进行测试(第一个答案),但没有运气。 如警告中所述 Dec 09, 2020 9:16:16 PM io.cucumber.testng.TestNGCucumberOptionsProvider warnWhenJUnitCucumberOptionsAreUsed WARNING: Ignoring options provided by io.cucumber.junit.CucumberOptions on cucumberOptions.TestRunner. It is recommend to use separate runner classes for JUnit and TestNG. 当前您正在导入 junit cucumber 选项。 import io.cucumber.junit.CucumberOptions; 对于 TestNg 运行器类,您需要导入 testng.CucumberOptions import io.cucumber.testng.CucumberOptions; cucumber-jvm 存储库中的示例 import io.cucumber.testng.AbstractTestNGCucumberTests; import io.cucumber.testng.CucumberOptions; import org.testng.annotations.DataProvider; @CucumberOptions(plugin = { "html:target/results.html", "message:target/results.ndjson" }) public class RunCucumberTest extends AbstractTestNGCucumberTests { @DataProvider(parallel = true) @Override public Object[][] scenarios() { return super.scenarios(); } } 我遇到了同样的问题,我通过将 Cucumber 依赖项从版本 6.11.0 降级到 1.2.6 解决了这个问题,并且我确保 cucumber-java 和 cucumber-testng 具有相同的版本,即 pom.xml 中的 1.2.6你可以看到下面: Aslo 我的 TestRunner 类如下所示,而不是扩展 AbstractTestNGCucumberTests 你应该(cucumber.api.testng.AbstractTestNGCucumberTests) 我也有类似的问题。原因是我有多个与 junit5 和 testng 相关的依赖项,所以我删除了所有与 junit5 相关的依赖项,只保留了 testng 的依赖项。然后,有了功能文件和 testng.xml 的正确路径,它就开始工作了。

回答 3 投票 0

如何将示例表中的参数转换为 Cucumber 功能中的整数?

如果我有一个如下所示的功能: 特点:我的特点 场景大纲:我的场景大纲。 给定 foo 当酒吧 然后我得到状态代码“”。

回答 1 投票 0

如何在 cucumber-jvm 运行的 junit 报告中添加自定义文本

我们正在使用bamboo 来漂亮地打印junit 输出以进行测试,我想在报告中添加一些版本信息。有没有办法做到这一点?我使用以下参数: --plugin junit:./ou...

回答 2 投票 0

带有 Kafka 的柑橘黄瓜测试用例未按预期工作

我用 Citrus Framework 编写了一个 Cucumber 测试用例,我想在其中测试一个在内部向 Kafka 发布消息的 HTTP 调用。我编写了一个测试用例来使用“Given,...

回答 1 投票 0

Playwright:无法在第二步中获取浏览器Behave Cucumber Framework

这是我的代码,我在 Playwright 上使用 Python,因为我之前使用了 selenium,当你只在第二步中调用 context.driver 时,它会工作,但在 playwright 上它会返回一个错误 文件...

回答 1 投票 0

Cucumber禁用代理并使用直接连接

我正在尝试编写一个黄瓜测试,该测试使用 Watir Webdriver 和 selenium 以及 Headless gem。 我收到错误: 超时::错误: 超时::错误 来自 /var/lib/jenkins/.rvm/rubies/ruby-1.9.2...

回答 2 投票 0

如何解决“无法在‘响应’上执行‘json’:正文流已读取”问题?

在此输入图像描述 *类型错误:无法在“响应”上执行“json”:主体流已读取 以下错误源自您的应用程序代码,而不是来自赛普拉斯。这是造成的...

回答 1 投票 0

直接从pom.xml运行cucumber功能文件

我们在项目中使用cucumber(带有java)来实现自动化(带有mvn)。我有一种情况,我需要执行一个功能文件,例如套件开头的 feature_fil1 。 因为我们所有的

回答 1 投票 0

观察到的包 ID 'build-tools;20.0.0' 位置不一致

./gradlew --parallel :app:assembleDebugTest 当我在 android studio 终端中运行上述命令时,出现此错误。 错误 并行执行是一个正在孵化的功能。 观察到包 id 'build-t...

回答 5 投票 0

运行 allure 服务生成报告给出错误:spawn EINVAL

>诱惑服务 节点:内部/子进程:421 抛出新的 ErrnoException(err, 'spawn'); ^ 错误:生成 EINVAL 在 ChildProcess.spawn (节点:内部/child_process:421:11) 在对象...

回答 1 投票 0

QAF Allure 报告未生成

Allure 报告未在 QAF 框架(testng)中生成。我在 pom.xml 中配置了以下配置 io.qameta.allure 阿尔...

回答 1 投票 0

黄瓜测试运行的顺序是什么

我知道 Cucumber 从上到下运行功能文件中的每个测试,但我的问题是,功能文件按什么顺序运行?它似乎不是按字母顺序排列的,也不是按任何结构顺序排列的。

回答 2 投票 0

指定测试用例不使用 Cucumber 与 Spring 中的 TestNG 运行器并行运行

我已经能够使用 TestNG 运行程序将项目配置为并行运行测试用例;然而,有一些场景不是很线程安全。如果这些测试用例成功...

回答 2 投票 0

Cucumber 我想要一个在 try 块中运行给定步骤的步骤

我在cucumber和kotlin中有一个自动化项目,有很多步骤,有时我希望运行一个步骤,并且如果失败也不要停止测试,即在try块内运行它(我称之为软步骤)。 .

回答 1 投票 0

水豚测试上一个屏幕

在 ruby on Rails 应用程序中,我有一个“主屏幕”haml,其中带有一个添加按钮,可将用户带到“addscreen”按钮。我已经使用 Caybara 和 Selenium 创建了一个测试,检查是否...

回答 1 投票 0

如何在 Playwright 框架中将屏幕截图附加到 Cucumber HTML 报告?

我正在尝试将屏幕截图添加到我的 Playwright 测试框架中的 Cucumber HTML 报告中。 这是我的reporter.js: const 记者 = require('cucumber-html-reporter') 常量选项 = { 主题:'

回答 1 投票 0

在线Cucumber报告和控制台输出在同一行

这是一个selenium java项目,使用Intellij Idea来运行测试自动化场景。它最后生成在线黄瓜报告。但正如你在图片中看到的,不幸的是,它梳理了......

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.