Run Android Junit
还没有人认领这个 Issue。
评估
调研方向
从 shared/src/androidTest/kotlin/com/jetbrains/kmm/shared/androidTest.kt 开始,检查 Android 测试设置和生成的 Gradle 任务。运行 ./gradlew :shared:tasks,并将可用的 unit-test 和 connected-test 任务与预期的 Android JUnit 行为进行比较。完成的标准是,shared Android 测试能够被识别,并通过 JUnit 配置在 JVM 上运行,而不是在设备上运行。
由索引模型根据 Issue 内容生成。
描述
Using this project as a base to understand how to run JUnit Android test within the shared Library: https://github.com/Kotlin/kmm-sample/blob/master/shared/src/androidTest/kotlin/com/jetbrains/kmm/shared/androidTest.kt
Cross-posting from Android Studio issue: https://issuetracker.google.com/issues/191287536
I'm not sure if it's a code issue (so a modification on this code base), or a IDE issue.
Goal: run with JUnit the tests with the Android configuration on the shared module.
Issue: the junit test folder is not recognized as such with Android, it seems to be override by an Android Connected test.
Symptoms:
1- "No Task Available"
by right-click on the folder, clicking on "Run test", it creates a configuration that does not work.
The issue seems to be that Android Studio doesn't recognised "kotlin" as a valid language for testing. By renaming the folder "kotlin" within the test to "java", it is now possible to run it.
2- Test run on device, not on JUnit
- when started the test, it will try to run it by starting the emulator. It should instead run it on the JVM like any other android JUnit test. It's because the "Run/Debug configuration" is using a "Android Instrumented Tests" instead of "JUnit" configuration.
By trying to manually setup a JUnit configuration, the module Android Test does not appear.
By running the CLI "./gradlew :shared:tasks", I am missing some configurations (it should contains "androidTest" - Executes unit tests for target Android.):
Verification tasks
------------------
allTests - Runs the tests for all targets and create aggregated report
check - Runs all checks.
connectedAndroidTest - Installs and runs instrumentation tests for all flavors on connected devices.
connectedCheck - Runs all device checks on currently connected devices.
connectedDebugAndroidTest - Installs and runs the tests for debug on connected devices.
deviceAndroidTest - Installs and runs instrumentation tests using all Device Providers.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
iosX64Test - Executes Kotlin/Native unit tests for target iosX64.
lint - Runs lint on all variants.
lintDebug - Runs lint on the Debug build.
lintRelease - Runs lint on the Release build.
test - Run unit tests for all variants.
testDebugUnitTest - Run unit tests for the debug build.
testReleaseUnitTest - Run unit tests for the release build.
Build: AI-203.7717.56.2031.7435690, 202106072248,
AI-203.7717.56.2031.7435690, JRE 11.0.10+0-b96-7281165x64 JetBrains s.r.o., OS Mac OS X(x86_64) v11.2.3, screens 3584.0x2240.0; Retina
AS: Arctic Fox | 2020.3.1 Beta 4; Kotlin plugin: 203-1.5.10-release-891-AS7717.8; Android Gradle Plugin: 4.0.1; Gradle: 6.5; Gradle JDK: version 11.0.10; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
- 主要语言
- Kotlin
- 星标
- 1.1k
- 派生
- 201
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Kotlin/kmp-basic-sample 的其他 Issue
-
iOS TextField not expand verse vertical axis.可能已有人在做 @Jaehwa-Noh 于 436 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
Kotlin/kmp-basic-sample#84 ·
-
Support for web未关闭
难度 5/5 一周以上 新手友好度 25/100
Kotlin/kmp-basic-sample#82 ·
-
难度 4/5 3-5 天 新手友好度 25/100
Kotlin/kmp-basic-sample#81 ·
-
难度 3/5 1-2 天 新手友好度 25/100
Kotlin/kmp-basic-sample#75 ·
-
难度 3/5 1-2 天 新手友好度 25/100
Kotlin/kmp-basic-sample#71 ·
查看 Kotlin/kmp-basic-sample 的全部 Issue
相似的 Issue
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 76/100
xybrid-ai/xybrid#661 · 1 条评论 ·
维护者通常 1 天内回复
-
android bug kotlin vulkan
难度 2/5 1-3 小时 新手友好度 68/100
maplibre/maplibre-native-ffi#852 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
-
documentation importer size:S
难度 2/5 1-3 小时 新手友好度 72/100
enorm-labs/event-junkie#3614 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
InsertKoinIO/koin#2477 ·