我们如何知道在 BDD 方法中 运行 Selenium Java 需要哪些 Cucumber jar 文件?
How do we know what Cucumber jar files are needed to run Selenium Java in BDD approach?
我从一些教程网站上了解到,如果我们想将 Cucumber 集成到我们的 Selenium Java 项目中,我们需要下载所有这些 jar 文件并将其添加到项目中:
- 黄瓜核心
- 黄瓜-java
- 黄瓜-junit
- 黄瓜-jvm-deps
- 黄瓜报告
- 小黄瓜
- junit
- mockito-all
- cobertura
我的问题是,是否有任何官方网站告诉我们需要哪些 jar 文件?就像 Selenium official website 有下载部分,可以在一个 zip 包中下载所有需要的 jar 文件,所以我们不会错过任何重要的 jar。
我查看了Cucumber official website,没有下载部分。
在这个 repository site 中,有很多文件可供下载,如果我们不知道需要哪一个,那么我们可能会迷路。我们怎么知道我们需要什么罐子?非常感谢。
这取决于您在代码中引用的所有库。
对于 运行 使用 junit 的基本黄瓜测试,您需要以下依赖项
黄瓜-java
junit
Cucumber-junit
硒-java
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
</dependency>
</dependencies>
以下为官方link供参考。
https://cucumber.io/docs/reference/jvm
cucumber-java 将加载您上面提到的大部分依赖项,无需再次编写它们。
下面是cucumber的内部依赖列表-java
<parent>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.5</version>
</parent>
<artifactId>cucumber-java</artifactId>
<packaging>jar</packaging>
<name>Cucumber-JVM: Java</name>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
如果您有任何疑问,请告诉我
我从一些教程网站上了解到,如果我们想将 Cucumber 集成到我们的 Selenium Java 项目中,我们需要下载所有这些 jar 文件并将其添加到项目中:
- 黄瓜核心
- 黄瓜-java
- 黄瓜-junit
- 黄瓜-jvm-deps
- 黄瓜报告
- 小黄瓜
- junit
- mockito-all
- cobertura
我的问题是,是否有任何官方网站告诉我们需要哪些 jar 文件?就像 Selenium official website 有下载部分,可以在一个 zip 包中下载所有需要的 jar 文件,所以我们不会错过任何重要的 jar。
我查看了Cucumber official website,没有下载部分。
在这个 repository site 中,有很多文件可供下载,如果我们不知道需要哪一个,那么我们可能会迷路。我们怎么知道我们需要什么罐子?非常感谢。
这取决于您在代码中引用的所有库。
对于 运行 使用 junit 的基本黄瓜测试,您需要以下依赖项
黄瓜-java
junit
Cucumber-junit
硒-java
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
</dependency>
</dependencies>
以下为官方link供参考。 https://cucumber.io/docs/reference/jvm
cucumber-java 将加载您上面提到的大部分依赖项,无需再次编写它们。
下面是cucumber的内部依赖列表-java
<parent>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.5</version>
</parent>
<artifactId>cucumber-java</artifactId>
<packaging>jar</packaging>
<name>Cucumber-JVM: Java</name>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
如果您有任何疑问,请告诉我