Every time I want to do a quick test of some code, android studio takes 20-40 minutes loading an emulator which then either crashes my laptop or makes it run very slow. Is there any way to just use the system log without loading the whole app, similar to the System.out.Prinln() feature in net beans?
I understand that the question is about running your app for quick testing and not about automated tests. But you can learn a lot by trying to adapt writing tests, and they can help you to solve your problem.
1) For code without android dependencies you can write JUnit tests and run those just on JVM to test the code. Bonus: you'll start with creating your testsuite!
2) For code with android dependencies: a) Try to be better in separating platform specific code and internal logic so you will be able to cover more code with unit tests. b) You can use roboelectric and test everything without emulator/device for the rest.
Related
Can I test code on android studio without run real phone or emulator ?
I want only test code only without UI (user interface) , For example test only :
Log.w("test", "a");
Consider writing Unit Tests, you can check how write unit tests with examples like https://www.journaldev.com/22674/android-unit-testing-junit4
Local Unit tests run on your computer & no emulator or device is required.
We are supposed write tests for the functionality which we have written. For classes not written by you, you can use Mocks with libs like Mockito.
I am trying to automate the "UI testing" for my android application by using firebase testlab. I have saved a script in android studio but want to limit the robot for any further monkey testing. All it does is after my sctipts runs successfully, it starts doing monkey testing, which is of no use to me.
I read it online it can be controlled using "maxDepth" but couldn't find anything more. Would appreciate if someone could help me implement this.
maxDepth was only supported by Robo v1. It has been deprecated and has not had any effect on Robo tests for a long time. The standard way to limit the length of a Robo test now is to use the timeout flag/option.
A possible(?) alternative would be to have your Robo script exit your app when it is done, but I have never tried that and am not sure how it would work.
Is there a way to create an espresso test file from a class like does Command / Control+Shift+T?
Same for launch the current test with espresso into the device?
It's very annoying to create/launch every test manually through the whole process of going to the file's hierarchy and then create the launch configuration of it. Neither an option is hidden in options?
If I remember well, these functionalities were available on Android Studio 2.3, I noticed the lack of them from AS3.0. Where did they go?
As today, Android Studio 3.1.1 comes with the functionality just as before
I am using Robotium to test the GUI in my Android application. When I run my tests through eclipse they all pass without a hitch, however when I run them through maven the tests seem to fail randomly. The activity screens can sometimes hang before the crash, other times I get the error that the text to be clicked on cannot be found, when I can see it on the emulator. I have solo.waitForText() and solo.waitForActivity() in all the necessary places and have tried many different code rewrites but I get the same issue every time.
Has anyone else come across this issue with Robotium and found a solution? It is a fantastic framework and allows thorough testing of applications so I would like to use it if at all possible.
Chuck
Please update Robotium to version 3.4.1. The issue that you are describing has been fixed in the new version.
If your issue still exists in 3.4.1 please file a defect report on:
http://code.google.com/p/robotium/issues/list
I have been trying to code and run the hello world application but am not able to get the emulator to boot all the way. Plan b is vb.
HELP!
Do you mean VB or VB.NET?
The Mono project recently announced VB.NET support, though C# is the preferred language (do yourself a favor and switch!). Since Mono runs on Android (and just about everything else), it should get you going in the right direction.
Update Okay, downvoters: a little lesson in basic math: the transitive property of inequalities states that if a < b, and b < c, then a < c.
So:
If VB.NET can be compiled by Mono,
and Android supports the Mono framework,
Then Vb.Net can be used to write an Android application.
We can get into a discussion about the available features, framework completeness, etc, but the OP asked about compiling "Hello world" in VB for Android.
Or, skip the above references and just consider this: The MS VB compiler produces MSIL/CIL.
Just take the CIL that the compiler produces and throw it into Mono. The Mono compiler will convert this to IR, optimize it and produce the appropriate binary for the target platform.
If you're going to downvote, cite your sources instead of arbitrarily throwing out acronym soup that is irrelevant to the topic at hand.
Unfortunately, you can not run a visual basic application on Android. Maybe if you provide some additional information about the problem you are having with the emulator we can help with that?
I'll guess at the emulator issue...
Sometimes the emulator can be quite slow. If you are impatient and start clicking on buttons in the emulator before it has finished, it doesn't seem to work properly. I did this when I first started and thought the emulator was broken - but it actually just took several minutes to launch. My clicking on buttons just made sure it never finished.
Try running your helloworld program, but be sure to wait until the emulator is fully ready to go before you interact with it.
The good news is, once you have launched the emulator once, you can keep the emulator running while you write and try out your code.