Showing posts with label Android Studio. Show all posts
Showing posts with label Android Studio. Show all posts

4/27/2016

Google Cloud Test Lab with Robotium

Last time I setup Cloud Test Lab to execute instrumentation tests on the cloud, and Espresso was used as a default testing framework, but we can, of course, choose other options!

This time, let's use Robotium!


Setup

If you setup the NotePad app by following my previous post or  the official guide of Cloud Test Lab, then Robotium should be configured already.

Otherwise, you need to configure it by yourself in advance.
Since official tutorial doesn't cover Android Studio, you can refer these helpful web pages:


As well, if you'd like to use screenshot functions with your own app, you can find the instructions from the official guide.

Implementation

Default NotePadTest class (Espresso) is written like the following:


So, just we can make new test class with Robotium!
Robotium API reference is available from here.


Edit configuration & Run! 😄


[Android Studio 2.0]
[Robotium 5.3.0]

4/26/2016

A quick tour of Cloud Test Lab

Following a guide of Cloud Test Lab, I successfully made instrumentation tests on the cloud with Android Studio! 😄
https://developers.google.com/cloud-test-lab/

1. Create a billing account on Google Cloud Platform (free trial)

*You need to input your credit card info, but won't be charged unless you change the plan.

2. Create/edit .vmoptions file with this line:

here is how to find .vmoptions file. (You can make new one if not found)
(e.g.) Mac+AndroidStudio 2.0:  ~/Library/Preferences/AndroidStudio2.0/studio.vmoptions

3. Download and set up a sample app (or use your own app with instrumentation tests)
You can get a sample app (notepad.zip) from the guidance page.
https://developers.google.com/cloud-test-lab/android-studio#download_and_try_a_sample_app

4. Edit configuration
Select "Edit Configurations..." from app pulldown


Create new Android Tests


Configure general info by following the guidance page.
(You need to configure it properly if you use your own app)
https://developers.google.com/cloud-test-lab/android-studio#configure_a_test_matrix_and_run_a_test


You need to connect to Google Cloud Platform after you choose a target option "Cloud Test Lab Device Matrix":


Then you can choose a project on Google Cloud Platform or create a new one from "click here" link:




As well, you can choose test devices, platforms, locales and orientations from three dots button next to Matrix configuration:


5. Run your test!
You can see progress in Run window.


Output URL link leads to Test Lab page on Google Cloud Platform where you can view test results.




Since NotePadTest contains following line, you can check screenshots from the console.



Even you can see a video for each test case!

Done! 😄
As well, I wrote Cloud Test Lab + Robotium in next post!

[Android Studio 2.0]

4/12/2016

System Health dialog

I updated Android Studio to version 2 and got this message.


My Java version was...
java -version


So, simply updated to the latest version from http://www.oracle.com/technetwork/java/javase/downloads/index.html

Or I could export STUDIO_JDK to launch Android Studio with specific JDK outside the problematic range.
export STUDIO_JDK=/path/to/specific/jdk1.8.0_**.jdk
STUDIO_JDK is used to run Android Studio.
It is different from JDK Location (File/Project Structure.../SDK Location) which is used for app build.

[Android Studio 2.0]