arve
07/30/2025, 11:02 AMkotest
to work with amper? For me it’s reporting something like “no test classes found”Anton Prokhorov
07/30/2025, 1:49 PMjoffrey
07/30/2025, 1:49 PMjoffrey
07/30/2025, 1:49 PMAnton Prokhorov
07/30/2025, 2:00 PMsuresh
07/31/2025, 8:07 PMno test were discoverd error
even though tests are there in shared/test folder
$ ./amper test
...
00:03.401 WARN :jvm:testJvm No test classes, skipping test execution for module 'jvm'
00:06.454 INFO :shared:testJvm Testing module 'shared' for platform 'jvm'...
ERROR: JVM tests failed for module 'shared' with exit code 2 (no tests were discovered) (see errors above)
By the way, in amper, should a test run as part of a build/package or do we need to explicitly invoke it?joffrey
07/31/2025, 8:15 PMno test were discoverd error
even though tests are there in shared/test folder
I believe you might be running into the common issue that the defaults of the JUnit Console launcher (which we're using) is to filter only test classes that start or end with Test
or Tests
. This is a bit confusing and we might change it. Could you please confirm whether your test classes were missing such suffix/prefix? Do you get the same issue if you rename your classes to add such suffixes/prefixes?joffrey
07/31/2025, 8:16 PMBy the way, in amper, should a test run as part of a build/package or do we need to explicitly invoke it?In Amper we decided that the
build
command was only for building (initially we even called it compile
to avoid confusion with Gradle semantics). ./amper test
will of course compile before testing.
So yes, you do need to call ./amper test
if your goal is to run tests.suresh
07/31/2025, 8:26 PMimport kotlin.test.Test
import kotlin.test.assertTrue
class WorldTest {
@Test
fun doTest() {
assertTrue(World().get().contains("World"))
}
}
suresh
07/31/2025, 8:27 PMsuresh
07/31/2025, 8:27 PMjoffrey
07/31/2025, 9:14 PM00:03.152 INFO :shared:compileMingwX64Debug Downloading <https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-native-prebuilt/2.2.0/kotlin-native-prebuilt-2.2.0-windows-x86_64.zip> to C:\Users\Joffrey.Bion\AppData\Local\JetBrains\Amper\download.cache\90f79a2489-kotlin-native-prebuilt-2.2.0-windows-x86_64.zip
00:03.808 INFO :shared:compileJvm Compiling module 'shared' for platform 'jvm'...
00:07.650 WARN :shared:compileJvm file:///D:/projects/TESTS/kmp-cli/shared/src/World.kt:1:1 'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta. Consider using the '-Xexpect-actual-classes' flag to suppress this warning. Also see: <https://youtrack.jetbrains.com/issue/KT-61573>
00:07.650 WARN :shared:compileJvm file:///D:/projects/TESTS/kmp-cli/shared/src@jvm/World.kt:1:1 'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta. Consider using the '-Xexpect-actual-classes' flag to suppress this warning. Also see: <https://youtrack.jetbrains.com/issue/KT-61573>
00:07.678 INFO :shared:compileJvmTest Compiling module 'shared' for platform 'jvm'...
00:07.686 WARN :jvm-cli:testJvm No test classes, skipping test execution for module 'jvm-cli'
00:08.215 INFO :shared:testJvm Testing module 'shared' for platform 'jvm'...
Started WorldTest
Started doTest()
Passed doTest()
Test run finished after 178 ms
[ 4 containers found ]
[ 0 containers skipped ]
[ 4 containers started ]
[ 0 containers aborted ]
[ 4 containers successful ]
[ 0 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 1 tests started ]
[ 0 tests aborted ]
[ 1 tests successful ]
00:09.679 INFO :shared:compileMingwX64Debug Extracting C:\Users\Joffrey.Bion\AppData\Local\JetBrains\Amper\download.cache\90f79a2489-kotlin-native-prebuilt-2.2.0-windows-x86_64.zip to C:\Users\00:24.615 INFO :shared:compileMingwX64Debug Compiling module 'shared' for platform 'mingwX64'...
00:30.834 ERROR :shared:compileMingwX64Debug D:\projects\TESTS\kmp-cli\shared\src\World.kt:1:1: warning: 'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta. Consider using the '-Xexpect-actual-classes' flag to suppress this warning. Also see: <https://youtrack.jetbrains.com/issue/KT-61573>
00:30.834 ERROR :shared:compileMingwX64Debug expect class World() {
00:30.849 ERROR :shared:compileMingwX64Debug ^^^^^^
00:30.849 ERROR :shared:compileMingwX64Debug D:\projects\TESTS\kmp-cli\shared\src@mingw\World.kt:1:1: warning: 'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta. Consider using the '-Xexpect-actual-classes' flag to suppress this warning. Also see: <https://youtrack.jetbrains.com/issue/KT-61573>
00:30.850 ERROR :shared:compileMingwX64Debug actual class World {
00:30.850 ERROR :shared:compileMingwX64Debug ^^^^^^
00:30.867 INFO :windows-cli:linkMingwX64TestDebug No test code was found compiled for fragments [commonTest, mingwTest, mingwX64Test, nativeTest] of module 'windows-cli', skipping linking
00:30.867 INFO :windows-cli:testMingwX64Debug No test binary was found for mingwX64, skipping test run
00:30.884 INFO :shared:compileMingwX64TestDebug Compiling module 'shared' for platform 'mingwX64'...
00:42.017 INFO :shared:testMingwX64Debug Testing module 'shared' for platform 'mingwX64'...
[==========] Running 1 tests from 1 test cases.
[----------] Global test environment set-up.
[----------] 1 tests from WorldTest
[ RUN ] WorldTest.doTest
[ OK ] WorldTest.doTest (0 ms)
[----------] Global test environment tear-down
[==========] 1 tests from 1 test cases ran. (0 ms total)
[ PASSED ] 1 tests.
(by the way, I'll remove these nasty warnings about expect/actual classes, sorry about this)joffrey
08/01/2025, 12:10 AM./amper test
?arve
08/01/2025, 12:21 AMsuresh
08/01/2025, 12:35 AM00:06.466 WARN :jvm:testJvm No test classes, skipping test execution for module 'jvm'
00:06.867 INFO :shared:testJvm Testing module 'shared' for platform 'jvm'...