Gradle, libWithTests test: check js tests running, add test results assertion

This commit is contained in:
Sergey Rostov
2019-05-22 13:56:44 +03:00
parent 709afdfa45
commit 78fe2fde33
4 changed files with 75 additions and 5 deletions
@@ -432,8 +432,6 @@ class NewMultiplatformIT : BaseGradleIT() {
) )
val expectedKotlinOutputFiles = listOf( val expectedKotlinOutputFiles = listOf(
kotlinClassesDir(sourceSet = "js/main") + "new-mpp-lib-with-tests.js",
kotlinClassesDir(sourceSet = "js/test") + "new-mpp-lib-with-tests_test.js",
*kotlinClassesDir(sourceSet = "jvmWithJava/main").let { *kotlinClassesDir(sourceSet = "jvmWithJava/main").let {
arrayOf( arrayOf(
it + "com/example/lib/JavaClassUsageKt.class", it + "com/example/lib/JavaClassUsageKt.class",
@@ -466,6 +464,14 @@ class NewMultiplatformIT : BaseGradleIT() {
) )
expectedKotlinOutputFiles.forEach { assertFileExists(it) } expectedKotlinOutputFiles.forEach { assertFileExists(it) }
assertTestResults(
"testProject/new-mpp-lib-with-tests/TEST-all.xml",
"jsBrowserTest",
"jsNodeTest",
"test", // jvmTest
"${nativeHostTargetName}Test"
)
} }
} }
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<results>
<testsuite name="com.example.lib.TestCommonCode" tests="2" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testId" classname="com.example.lib.TestCommonCode" time="..." />
<testcase name="testExpectedFun" classname="com.example.lib.TestCommonCode" time="..." />
<system-out />
<system-err />
</testsuite>
<testsuite name="com.example.lib.TestCommonCode" tests="2" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testId" classname="com.example.lib.TestCommonCode" time="..." />
<testcase name="testExpectedFun" classname="com.example.lib.TestCommonCode" time="..." />
<system-out />
<system-err />
</testsuite>
<testsuite name="com.example.lib.TestCommonCode" tests="2" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testId" classname="com.example.lib.TestCommonCode" time="..." />
<testcase name="testExpectedFun" classname="com.example.lib.TestCommonCode" time="..." />
<system-out><![CDATA[1]]></system-out>
<system-err />
</testsuite>
<testsuite name="com.example.lib.TestCommonCode" tests="2" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testId" classname="com.example.lib.TestCommonCode" time="..." />
<testcase name="testExpectedFun" classname="com.example.lib.TestCommonCode" time="..." />
<system-out />
<system-err />
</testsuite>
<testsuite name="com.example.lib.TestJava" tests="1" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testJava" classname="com.example.lib.TestJava" time="..." />
<system-out />
<system-err />
</testsuite>
<testsuite name="com.example.lib.TestJs" tests="1" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testJsSpecificCode" classname="com.example.lib.TestJs" time="..." />
<system-out />
<system-err />
</testsuite>
<testsuite name="com.example.lib.TestJs" tests="1" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testJsSpecificCode" classname="com.example.lib.TestJs" time="..." />
<system-out />
<system-err />
</testsuite>
<testsuite name="com.example.lib.TestWithJava" tests="1" skipped="0" failures="0" errors="0" timestamp="..." hostname="..." time="...">
<properties />
<testcase name="testJavaClass" classname="com.example.lib.TestWithJava" time="..." />
<system-out />
<system-err />
</testsuite>
</results>
@@ -23,12 +23,17 @@ kotlin {
targets { targets {
fromPreset(presets.jvm, 'jvmWithoutJava') fromPreset(presets.jvm, 'jvmWithoutJava')
fromPreset(presets.jvmWithJava, 'jvmWithJava') fromPreset(presets.jvmWithJava, 'jvmWithJava')
fromPreset(presets.js, 'js')
fromPreset(presets.macosX64, 'macos64') fromPreset(presets.macosX64, 'macos64')
fromPreset(presets.linuxX64, 'linux64') fromPreset(presets.linuxX64, 'linux64')
fromPreset(presets.mingwX64, 'mingw64') fromPreset(presets.mingwX64, 'mingw64')
} }
sourceSets {
js {
browser()
nodejs()
}
sourceSets {
commonTest { commonTest {
dependencies { dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-common' implementation 'org.jetbrains.kotlin:kotlin-test-common'
@@ -11,7 +11,10 @@ repositories {
kotlin { kotlin {
val jvmWithoutJava = jvm("jvmWithoutJava") val jvmWithoutJava = jvm("jvmWithoutJava")
val jvmWithJava = targetFromPreset(presets["jvmWithJava"]) val jvmWithJava = targetFromPreset(presets["jvmWithJava"])
val js = js() val js = js {
browser()
nodejs()
}
val macos64 = macosX64("macos64") val macos64 = macosX64("macos64")
val linux64 = linuxX64("linux64") val linux64 = linuxX64("linux64")
val mingw64 = mingwX64("mingw64") val mingw64 = mingwX64("mingw64")