Cucumber需要哪些Maven依赖项,我使用Testng作为我的测试框架

Cucumber需要哪些Maven依赖项,我使用Testng作为我的测试框架,maven,selenium,cucumber,testng,browser-automation,Maven,Selenium,Cucumber,Testng,Browser Automation,以下是我的自动化框架中的工具/jar 硒 Testng 马文 詹金斯 詹金斯在这里是多余的。您的最小依赖项是: <dependencies> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-java</artifactId> <version>1.2.5</version

以下是我的自动化框架中的工具/jar

  • Testng
  • 马文
  • 詹金斯

  • 詹金斯在这里是多余的。您的最小依赖项是:

     <dependencies>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>1.2.5</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.9.8</version>
            <scope>test</scope>
        </dependency>
    
    
    信息杯
    黄瓜爪哇
    1.2.5
    测验
    信息杯
    黄瓜汁
    1.0.5
    测验
    信息杯
    黄瓜试验
    1.2.5
    编写
    朱尼特
    朱尼特
    org.testng
    testng
    6.9.8
    测验
    
    以上依赖项已过时。改用最新版本(注意组id已更改):

    黄瓜:

    <dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>2.3.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    
    黄瓜
    黄瓜爪哇
    2.3.1
    测验
    
    (注意:如果要使用lambda语法,也可以使用cucumber-java8)

    对于黄瓜测试:

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>2.3.1</version>
    </dependency>
    
    
    黄瓜
    黄瓜试验
    2.3.1
    
    注意:确保使用相同的黄瓜版本


    好了,您不再需要cucumber jvm deps了。

    下面列出的依赖项足以从cucumber开始

    将以下内容添加到maven项目中的pom.xml:

    <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.5</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.5</version>
    </dependency>
    
    
    信息杯
    黄瓜爪哇
    1.2.5
    信息杯
    黄瓜刺柏
    1.2.5
    
    另外,在编写TestRunner类时,只需将鼠标悬停在@RunWith annotation上,并根据建议添加testng库

    别忘了添加selenium和testng依赖项

    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.testng/testng -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>test</scope>
    </dependency>
    
    
    org.seleniumhq.selenium
    硒爪哇
    3.141.59
    org.testng
    testng
    6.14.3
    测验
    

    我希望这些信息能有所帮助。

    以下是您需要的依赖项:

    <dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>6.9.1</version>
        </dependency>
    
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>6.9.1</version>
        </dependency>
    
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>6.9.1</version>
        </dependency>
    
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>
    </dependencies>
    
    
    黄瓜
    黄瓜爪哇
    6.9.1
    黄瓜
    黄瓜核
    6.9.1
    黄瓜
    黄瓜试验
    6.9.1
    org.seleniumhq.selenium
    硒爪哇
    3.141.59
    
    Thx,您能解释一下“cucumber jvm deps”是因为cucumber依赖的一些jar不是特定cucumber版本的一部分。黄瓜是Cucumber用于指定要素文件的方言的名称。相关的小黄瓜罐自动成为您的依赖项的一部分。Cucumber还使用了一些其他工具,这些工具与要素文件构造如何与步骤定义连接的内部管道有很大关系。这些和其他都打包在cucumber jvm deps jar中