-
Notifications
You must be signed in to change notification settings - Fork 11
/
CodeTest.kt
45 lines (29 loc) · 1.08 KB
/
CodeTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package foo
import foo.bar.Code
import org.testng.annotations.Test
/**
* @author kir
*/
class CodeTest {
@Test
fun test_ok() {
// Simple text metadata:
println("##teamcity[testMetadata key='some key' value='some value']")
// Numeric metadata
println("##teamcity[testMetadata key='a numeric value' type='number' value='${Code().value()}']")
// Reference to an artifact
// gradle_test_report.zip should be created by specifying corresponding artifact path in TC
val testsPath = "gradle_test_report.zip!/classes/${javaClass.name}.html"
println("##teamcity[testMetadata key='Gradle test report' type='artifact' value='$testsPath']")
publishScreenshot()
}
@Test
fun test_failure() {
test_ok();
throw Exception("And here comes some problem");
}
private fun publishScreenshot() {
println("##teamcity[publishArtifacts 'pictureForAttention.png']")
println("##teamcity[testMetadata type='image' name='Some screenshot' value='pictureForAttention.png']")
}
}