2017-04-01 31 views
0

我從一些網站的教程學習,如果我們想要黃瓜融入我們的硒Java項目,我們需要下載所有這些jar文件,並將其添加到項目中:我們如何知道在BDD方法中運行Selenium Java需要哪些Cucumber jar文件?

  1. 黃瓜核心
  2. 黃瓜 - java的
  3. 黃瓜的JUnit
  4. 黃瓜JVM-的DEP
  5. 黃瓜報告
  6. 小黃瓜
  7. JUnit的
  8. 的Mockito,所有
  9. 的Cobertura

我的問題,有沒有官方網站,告訴我們需要什麼樣的jar文件?就像Selenium official website有下載部分一個zip包中下載所有需要的jar文件,所以我們不會錯過任何重要的jar。

我登記了Cucumber official website,沒有下載部分。

在這repository site,有這麼多的文件可供下載,如果我們不知道哪一個是需要的,那麼我們可能會迷路。我們如何知道我們需要什麼罐子?非常感謝。

回答

2

它取決於您在代碼中引用的所有庫。

對於運行使用JUnit基本黃瓜測試,你需要下面的相關

黃瓜的Java

的JUnit

黃瓜,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> 
下面

是官方鏈接供參考。 https://cucumber.io/docs/reference/jvm

cucumber-java將加載大部分上面提到的依賴項,不需要再寫它們。

下面是黃瓜的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> 

讓我知道如果您有任何疑問

相關問題