KotlinTest也支持TestNG吗? [英] Does KotlinTest also support TestNG?

查看:206
本文介绍了KotlinTest也支持TestNG吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将KotlinTest与TestNG一起使用吗?在文档中,我只能看到JUnit.

Can I use KotlinTest with TestNG? I can see only JUnit in the documentation.

推荐答案

是的,您可以将TestNG与Kotlin一起使用.只需配置TestNG依赖项,您就可以开始工作了.它类似于Junit.下面是相同的示例程序:

Yes, you can use TestNG with Kotlin. Just configure TestNG dependency and you are good to go. It is similar to Junit. Below is a sample program for the same:

抽象类TestBase {

abstract class TestBase {

lateinit var driver: WebDriver
    private set

@BeforeTest
fun setup() {
    System.setProperty(UtilResources.getProperties("nameDriver"),
            UtilResources.getProperties("pathDriver") + UtilResources.getProperties("exeDriver"))
    driver = ChromeDriver()
    driver?.manage()?.timeouts()?.implicitlyWait(10, TimeUnit.SECONDS)
    driver?.manage()?.window()?.maximize()
    driver?.get(URI(UtilResources.getProperties("pageURL")).toString())
}

@AfterTest
fun driverClose() {
    driver?.close();
}

}

这篇关于KotlinTest也支持TestNG吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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