如何使用testng实施和运行黄瓜测试文件 [英] How to implement and run cucumber test files using testng

查看:95
本文介绍了如何使用testng实施和运行黄瓜测试文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试实现硒+黄瓜+ Testng代替Junit。

Trying to implement selenium + Cucumber + Testng instead of Junit.

我的查询是


  1. 在Testng中@Runwith(Cucumber.class)的替代方法是什么

  2. 如何运行包含要素文件路径的类文件







package runner;

import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;


@CucumberOptions(features="src/main/java/testCases/Cucumber/Login_Cucumber.Feature",glue="")
public class TestRunner extends AbstractTestNGCucumberTests {

}







推荐答案

TestNg使用@CucumberOptions标记声明参数

TestNg uses @CucumberOptions tag to declare parameters

@CucumberOptions(plugin = "json:target/cucumber-report.json")
public class RunCukesTest extends AbstractTestNGCucumberTests {
}

@CucumberOptions(features = "src/test/resources/features/Download.feature",
        glue = "uk.co.automatictester.jwebfwk.glue",
        format = {"pretty"})

查看以下内容:> https://github.com/cucumber/cucumber-jvm/tree/master/examples/java-calculator-testng

也可能是:如何将黄瓜整合到testNG中?

这篇关于如何使用testng实施和运行黄瓜测试文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆