Emulators and testing

Since Android Things is meant to be used with custom hardware, it is useless to have an emulator of just the dev kit. Also, given the wide variety of hardware that we can connect, it is almost impossible to emulate it; we would need a whole electronics set to be able to draw our project and then run it. Those are the reasons why Android Things does not have an emulator.

There is no emulator for Android Things.

In my experience, the lack of an emulator is not a problem. On the one hand, it is very satisfying to see the hardware working, and, on the other, many problems that you'll face will not be solved with an emulator, problems such as deciding how to arrange the components inside the chassis of a robot car or figuring out how many turns of a stepper motor are needed to activate a candy dispenser.

In my experience, the most common source of bugs when working with electronics is the actual wiring of the circuits. A loose cable or a misplaced connection are often the reason why something is not working and an emulator won't solve that. Besides, setting the connections on a program is usually more time-consuming than actually wiring them.

Finally, if you really want to use something like an emulator to test your project as you go along, my suggestion is to rely on testing using a mocking framework, such as Mockito or EasyMock, and either run instrumentation tests on the device or use Robolectric to run them on your computer.

You can test Android Things projects using Mockito and Robolectric.

While testing on Android Things is beyond the scope of this guide, and I don't recommend investing in it for just prototyping and tinkering; if you are planning on going to the mass market with any IoT project, testing should definitely be on your agenda.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.240.142