Desktop library for testing a real-time Android app

做~自己de王妃 提交于 2019-12-11 07:04:29

问题


I've written a real-time application for Android that receives hundreds of input events per second and spits out a few output events per second. The input events drive state machines to produce the output events. I write both the input and output events to a file for each run. I want to use the files of runs that I deem valid for regression testing. I'll feed the recorded input events to the system and look for the expected output events.

My system receives events via a looper/handler and uses timers, but it doesn't otherwise depend on the Android API except for android.util.log for debugging purposes, which I can easily wrap.

Which desktop framework will give me the APIs I need? Will a JUnit test suffice? Does this need to be an instrumented test? Do I actually need to run some sort of mocker library? This is my first Android app and I'm still getting my bearings.

Ideally, I'd write a command line tool in Java so I can vary the parameters that govern testing. I doubt the kind of testing I have in mind is suitable for any generic test framework, as some intelligence is required for deciding when to attempt to match actual results with expected results and when to halt the test run. I suspect I'm just looking for suitable desktop libraries.

I think I see how to write another Android app that would do the job, but that looks a lot more complicated than doing it from a shell, and it would be a lot less convenient to use as well. My backup plan is to test my system below the looper API (my library's public API) by using regular Java thread messaging. (I want to feed events to the system at their original timing.)

Update: As I search around for an answer, it's become clear that I could write a JUnit test that runs all my real-time tests, but complaints of slow emulation concern me. Timing is crucial during these tests. On the other hand, the desktop computer could run background processes that interfere with timing, so maybe I do have to create an test harness that runs on the device. Hoping for advice...

来源:https://stackoverflow.com/questions/41625120/desktop-library-for-testing-a-real-time-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!