mirror of
https://github.com/ysoftdevs/gradle-training.git
synced 2026-04-20 23:41:50 +02:00
add example how to run TestNG test with Gradle on Groovy code
This commit is contained in:
9
17-testng-groovy/build.gradle
Normal file
9
17-testng-groovy/build.gradle
Normal file
@@ -0,0 +1,9 @@
|
||||
apply plugin: 'groovy'
|
||||
|
||||
dependencies {
|
||||
compile gradleApi()
|
||||
}
|
||||
|
||||
test {
|
||||
useTestNG()
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ysoft.training
|
||||
|
||||
class Calculator {
|
||||
int add(x, y) {
|
||||
return x+y
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import com.ysoft.training.Calculator
|
||||
|
||||
import org.testng.annotations.Test
|
||||
import org.testng.Assert
|
||||
|
||||
class CalculatorTest {
|
||||
@Test
|
||||
void stitchInTimeSavesNine() {
|
||||
def calculator = new Calculator()
|
||||
Assert.assertEquals(calculator.add(4,5), 9)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user