从Android Studio运行Kotlin Koans测试

4

Windows 10,Android Studio 3.0。
所以我只是从主分支克隆了Kotlin Koans仓库,并尝试以两种不同的方式运行测试:
1.使用IDE时,当我按下测试方法旁边的绿色箭头时,我会看到:

Process finished with exit code 1
Class not found: "i_introduction._0_Hello_World.N00StartKtTest"Empty test suite.

2. 当我按照 Kotlin Koans 自述中的描述尝试使用终端时:

gradlew test --tests i_*

它给我一个输出结果:
:compileKotlin                                                                   
Using kotlin incremental compilation
Caught an exception trying to connect to Kotlin Daemon
java.lang.ClassNotFoundException: com.sun.tools.javac.util.Context

我看到很多建议说jdk文件夹中可能缺少tools.jar,我正在使用内部的Android Studios jdk,它在这里显示。

我还尝试禁用gradle deamons - 结果仍然相同。


尝试按照说明将其作为Gradle项目导入。 - eapen
我不知道它应该如何工作,但如果你在终端中输入 ./gradlew test,那么你就可以运行单独的单元测试。 - murt
2个回答

1

0

在测试你的实现时,你必须使用“任务描述”上的图标“检查任务”(即附件照片中的绿色勾选图标)。 enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接