enviroCar / enviroCar-app

enviroCar Android Application
https://envirocar.org
GNU General Public License v3.0
88 stars 154 forks source link

Running Unit Tests in Android Emulator #763

Closed TJ5 closed 2 years ago

TJ5 commented 2 years ago

I followed instructions in README.md to add the project to Android Studio. I'd like to see if I can run any existing tests in Android Emulator. Could you please assist me with instructions in how to do this? I'm happy to send a contribution to the documentation once I'm able to get this working.

asaikarthikeya commented 2 years ago

Hello @TJ5. As I understand it, You want to run the application on the Emulator and test the functionality. Right?

TJ5 commented 2 years ago

Right, through any existing unit tests for this project.

asaikarthikeya commented 2 years ago

Actually we need a OBD. But for testing purpose we have OBD Simulator ( as mentioned in the Readme) and also GPS option in settings.

OBD Simulator: You would require 2 smart phone to test this out. One mobile should contain the App and other with the Simulator. Both devices should be connected via Bluetooth. Now click start track in the app and you will see the app starts tracking the Journey.

GPS This is a bit easy way. Go to setting and turn on GPS tracking then start tracking.

To actually get the journey readings & tracking the device should move. Hence you would need to run it in a smart phone. Emulator cannot support this. Feel free to ask if you have any more question ;)

SebaDro commented 2 years ago

As @asaikarthikeya mentioned, you can use the OBD Simulator application. Just follow his instructions to get started. For now, I will close the issue. Feel free to open it again.

TJ5 commented 2 years ago

To make sure I understand, the OBD simulator and GPS tracking are ways to manually test the app? Are there any automatic tests in the repo currently, and if not, would they be helpful to implement? Tagging @SebaDro and @asaikarthikeya for follow up.

asaikarthikeya commented 2 years ago

Currently App supports only manual testing. As of not we donot have automatic testing support. Issue - #205

SebaDro commented 2 years ago

Yes, you can use the OBD simulator, which mocks the OBD adapter, for manually testing the app. However, I don't understand, what you mean with "automatic testing".

If you mean Unit testing: yes we have several Unit and Android tests which will be executed "automatically" when building the app.

If you mean to test the app with some dummy data as mentioned in #205: unfortunately, the app does not come with such a feature, so far.

TJ5 commented 2 years ago

Thank you @SebaDro and @asaikarthikeya . By automatic testing I really meant automated testing, apologies for the confusion. @SebaDro I did mean unit testing. Based on your response if I get a successful build, it means that several unit tests have also successfully run? Would it be helpful for me to contribute by adding more unit tests in order to improve unit test code coverage?