Trying to run trivial Android JUnit tests. Getting: “Test run failed: No test results” What am I missing?

后端 未结 1 579
暗喜
暗喜 2020-12-17 04:32

I have never used JUnit before, and now I\'m trying to set it up on an Android project.

My project under test is fairly complex, including some JNI, but my test proj

相关标签:
1条回答
  • 2020-12-17 04:47

    OK, I figured it out.

    And there is very little chance that anybody would have guessed what the problem is. I'm not sure what made me try it.

    I have some JNI code that prints error messages to stdout. That code is not running in my test project, but I use the same emulator. For that reason, I had a /data/local.prop that redirects stdout to logcat.

    It turns out that the test tools expect the output from the JUnit tests to appear on stdout. When the logcat redirect of stdout is on, nothing ends up on stdout, and the test system doesn't get the output, and so it fails to run.

    I removed my local.prop redirect of stdout to logcat, and rebooted the emulator, and now it works.

    It never occurred to me that the test system relied upon reading stdout itself.

    0 讨论(0)
提交回复
热议问题