Tag: testng

如何为TestNG Kotlin项目添加gradle支持?

我目前有一个testot安装Kotlin项目,当我右键单击src/test/kotlin文件夹,并选择Run All Tests 。 有用。 但是当我尝试用gradle输出一个源代码jar(包含测试用例)时,它开始抱怨: 18:38:08: Executing task ‘sourcesJar’… e: /Users/a/codes/objjson/src/test/kotlin/tests.kt: (7, 12): Unresolved reference: testng e: /Users/a/codes/objjson/src/test/kotlin/tests.kt: (22, 5): Unresolved reference: assertEquals e: /Users/a/codes/objjson/src/test/kotlin/tests.kt: (60, 6): Unresolved reference: Test ……. :compileKotlin FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:compileKotlin’. > Compilation error. See log for […]

如何组织断言来测试数据驱动的测试?

考虑一个例子: import org.testng.annotations.DataProvider; import org.testng.annotations.Test; public class DataProviderExampleTest { @Test(dataProvider="data") public void testDataProvider(int p1, String p2) { /* assert block for all p1 and p2 parameters */ // ??? // how to put p1 and p2 specific assertions here? //jst for example if (p2.equals("myString")) { //asserts for myString } if (p2.equals("otherString")) { //asserts for otherString […]

Allure在本地机器上生成空的报告页面

正如标题所说,我不能强迫Allure 2在本地机器上为我生成报告。 我尝试了很多谷歌的东西,但没有任何帮助。 我使用Kotlin + Selenide + TestNG编写测试,如果它帮助某种方式:)我有点混淆testNG ,因为它有testNG版本和Gradle版本 – 哪一个应该使用? 都? 这是我的build.gradle文件: group 'RegisteredUserFlow' version '1.0-SNAPSHOT' buildscript { ext.kotlin_version = "1.1.2-2" repositories { jcenter() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "ru.d10xa:gradle-allure-plugin:0.5.5" } } apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'ru.d10xa.allure' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 allure { aspectjweaver = true testNG […]

修改测试文件模板

在Kotlin类中选择“创建测试”时,我希望默认包含其他导入。 例如,目前只包含import org.testng.annotations.Test ,但是我也想import org.testng.Assert.* 。 如何修改IntelliJ中Kotlin / TestNG的测试文件模板?