Skip to content

Posts tagged ‘AnDevCon’

Instrumentation 101 – Must have tips for Android developers

December 18, 2012

deejoy

Thanks to everyone who came out to our class! It was great meeting and chatting with all of you Android developers. If you missed your chance to check out our 30 minute primer at AnDevCon IV, you’ll find the details of our Android Instrumentation 101 talk in this post along with download links for the demos and scripts used in the presentation. You can download the presentation here.

Testing can be boring and tedious, but its role is very important. In the long run you’ll save time fixing bugs in your application. Fortunately, Android supports many tools for testing. The ones we’ll cover include Monkey, MonkeyRunner, Robotium, and UIAutomator.

Monkey

Monkey is a simple and easy to use command line tool that is part of the Android SDK.

Monkey’s only purpose is stress testing your application. This means testing the things you would normally not test or think to test. Monkey provides a stream of random input events while your application is running with the primary goal of determining how your app preforms under such a load. This will test all kinds of strange input events and I assure you, your app will crash at some point under a corner case that you never imagined.

Monkey is not for testing specific app features and it is not smart (smart being, scriptable – you don’t tell Monkey what to do). Finally, Monkey is not a “cure-all.” It won’t find the bugs that other types of testing will find.

Monkey is simple, easy, and while not terribly exciting, it’s most definitely useful.

Monkey in action.

MonkeyRunner

In addition to stress testing, you may want to test a specific sequence of inputs. MonkeyRunner allows you to easily script your tests.

MonkeyRunner is a smarter Monkey in that it allows for better structured tests. You can do functional and regression testing using MonkeyRunner.
Some of its features include support for scripts written in Python, ability to take screenshots of the device, and the MonkeyRunner API is extensible. On the downside, it isn’t fast.

Things you’ll need to do:
• Learn Python
• Be aware that MonkeyRunner uses Jython. This means that your Python scripts can interface with java classes.

Understand how to use the three main modules of MonkeyRunner:
• MonkeyRunner – Connect to device
• MonkeyDevice – Call functions on the device (examples below)
• MonkeyImage – Take screenshots

The MonkeyRunner module allows your to connect to your device through a device object (MonkeyDevice). The device object allows you to call various methods, like:
• installPackage
• touch (pass in touch type)
• takeSnapshot
• startActivity

MonkeyRunner in action.

Robotium

Robotium is a powerful tool and API for testing your Android applications.

Robotium is more in depth and more robust than the tools mentioned above. The basic idea of Robotium is to create a testing APK that will exercise your target app through test cases that you write. In that way, it is very much like any standard testing framework. Robotium’s tag line is, “Like Selenium for Android,” so if you come from a web development background Robotium should be familiar ground for you. One more thing to note, Robotium is very fast which is a great boon to the testing experience.

On the downside, Robotuim requires some boilerplate. You’re going to have to create an APK, build with the Robotium JAR, and in general, be aware of the internals of the app you wish to test. That being said, it is quite powerful and, some might say, the de-facto testing tool for Android apps.

Robotium requires the Robotium JAR which can easily be downloaded from the Robotium website.

You’re going to need to know your APK’s package name and signature, though, you should have both if you are developing the app you wish to test.

Tests are set up by extending the main test class and writing methods for each test case. The Robotium Solo class provides the interface for testing on the device. That is, all of your testing commands will be issued from a solo object. As is the norm with testing, you’ll want to use assert to ensure test results.

If you take a look at the API later you’ll see that Robotium provides a bunch of methods, allowing you to do a lot with the app (switching activities being quite useful).

Finally, Robotium can be run from Eclipse or the command line (your preference) and provides output regarding test case success, failure, and error.

Robotium in action. 

UIAutomator

UIAutomator is a testing framework that has been added fairly recently.

It is part of the Android SDK revision 21 and up and requires your test device to have Android API version 16 or higher.

UIAutomator consists of:
• A command-line tool found on the device
• A Java library (uiautomator.jar found in the sdk/tools/) which you use in your tests
• The Android SDK tool UIAutomatorViewer which comes in handy for writing your tests
• The ability to reference UI Objects by name

UIAutomator comes with the UIAutomatorViewer tool that captures screenshot of the device and lists all the UI objects (great for identifying which components you want to test).

UIAutomater in action.

To see examples on using each tool, here are some of our presentation files:
Instrumentation101.zip

So far the tools we’ve seen, with the exception of Robotium, have done black box testing of the UI. However white box testing, whereby you test units internally, is just as important (there are a whole host of other tools that fill this role that we’ll cover in a future blog). For now, this is a primer on the types of tools available, what they are capable of,  and the roles that they fill. We hope we’ve provided a good launching point for you to get started.

The biggest thing to take away from the presentation and this blog is that you should make a habit of using some combination of these tools to test your apps. Develop a testing framework and stick to it. You are all programmers, so it should be no trouble for you to automate your tests. Don’t forget to test before every pull request!

Have any questions? Let us know in the comments.

Happy hacking,
Alex Bannerjee and Daniel Joyce

ZOMG! AnDevCon is next week!!

November 30, 2012

Apkudo

ZOMG! AnDevCon starts next week!! We’ve got a pretty packed schedule on Wednesday, dropping all kinds of knowledge. Come check out our classes:

Hacking APKs for Fun and Profit (Mostly for Fun), Part I
From 10:00 am – 11:45 am

Hacking APKs for Fun and Profit (Mostly for Fun), Part II
From 11:30 am – 12:45 pm

Come see David Teitelbaum dive deep into the internals of Android in this two-part, 150-minute class. You will explore the wonders of Dalvik bytecode, smali syntax, decompilation tools, patching techniques, and common methods you can use to (try to) protect your apps.

Extremely hands-on, you’ll be downloading a very popular app, modifying it, and messing around with its behavior. Even if you’re not that interested in APK hacking, you’ll leave this class with the sort of deep appreciation for Dalvik that makes good Android developers great.

And then from 1:45 pm – 2:15 pm Alex Bannerjee and Daniel Joyce are presenting:

Instrumentation 101: A 30-Minute Primer

Have you ever wanted to immerse yourself in the world of Android instrumentation, but only had 30 minutes or so to do it? You’re in luck because our 30 minutes will be jam-packed with all kinds of Android instrumentation goodness. This sponsored class will teach you the ins and outs of Android instrumentation and test automation. Come to learn how to effectively use the Monkey, MonkeyRunner and Robotium test-automation tools to better exercise your Android apps. You will be sure to leave with greater knowledge and better practices for Android test automation. Plus, you might even leave with a nifty new Apkudo t-shirt. Nice one.

But wait, there’s more!

Josh Matthews will be one of the speakers during the Lightning Talks from 5:30 – 7:00 pm! Without giving too much away, we will say that you’ll want to be there for a super exciting announcement. Don’t miss it.

On Thursday and Friday, be sure to drop by our booth (605/606)! The first 100 people to bring an APK will get a snazzy t-shirt and anyone who checks in on Foursquare to the Apkudo booth will get a Red Bull! While supplies last, anyway. What can we say? We’re a thirsty crew.

Until AnDevCon, Android Devs!

Let’s Get Buzzed Again, Shall We?

May 11, 2012

Apkudo

Boy oh boy, it feels like AnDevCon II was only yesterday, doesn’t it? All those workshops, classes, that fabulous expo…

Android developers – we’ve been missing you. Let’s #GetBuzzed again next week, shall we?

We’ve got a boatload of things happening at AnDevCon III and we can’t wait to see each and every one of you. Here’s what we’re up to:

Tuesday, May 15

At 1:45 pm Apkudo Engineer David Teitelbaum and CEO Josh Matthews will present the class, “Who Needs Thumbs? Android Instrumentation and Reverse Engineering.” This advanced level class will teach developers the fundamentals of APK reverse engineering, including Dalvik executable disassembly/reassembly, code injection, and view hacking using tools such as Smali/Baksmali and Romain’s awesome ViewServer, and then some. It’s so awesome that 9 out of 10 doctors recommend you should probably check it out.

After our kick-ass class, Josh will mesmerize everyone for 5 minutes with his Aussie accent during the AnDevCon Lightning Talks. Join us at 5:30 pm where you’ll hear from a bunch of great speakers talking about a bunch of great things. Josh will give a quick update on what we’ve been up to over here, including our work on our newest App Analytics project, Ape. And, hopefully, he won’t forget to mention our booth number this time (it’s #901).

Wednesday, May 16

This is when the fun begins. Join us in booth 901 when the exhibits open at 11:00 am! We’ve got cookies, we’ve got Red Bull, we’ve got tech previews, we’ve got a Winner’s Circle prize (Sony Blu-Ray player with built in Wi-Fi and Google TV), and we’ve also got your ticket to the free Apkudo Drink-Up at Knuckle’s Bar on May 16 from 7:00 – 10:00 pm. Pick up your t-shirt at our booth then wear it to the bar and drink/eat for free:

That’s a good lookin’ shirt.

We’ll also be talking about Apkudo Device Analytics for OEMs and Operators and its synergies with Apkudo App Analytics. As if all of this weren’t enough, we’ll have a few extra surprises at the booth to Monkey around with. Look, I can’t tell you what it is, but I’ll give you a hint. You’ve got to promise not to tell anyone, it’s a secret…if you bring your apk, we’ll bring the udo. 😉

Wednesday Night (still May 16)

Get your drinking pants (and t-shirts) on, cause we’re going to #GetBuzzed. Like I said above, wear your sweet new Hacker shirt to Knuckle’s Bar from 7:00 – 10:00 pm and drinks and snacks are on Apkudo. We’ve also got a themed drink, The Apkudo: Maker’s Mark on the Rocks. Like our Analytics platform, this drink is totally uncomplicated, incredibly easy, super awesome, and free! Plus, it’s kind of how we roll.

Thursday, May 17

Let us apologize in advance for your inevitable headache from the night before. Heed this advice: bring aspirin!

Didn’t get enough of Apkudo on Wednesday? Come check us out again at booth 901 from 11:00 – 2:30! Don’t forget to enter to win our Winner’s Circle prize – a Sony Blu-Ray player with built in Wi-Fi and Google TV!  The winner will be announced at 2:30 on the exhibit floor. Best of luck to everyone!

Wow! Just writing this is making me tired. I hope you’re all ready, AnDevCon III is going to be a blast! We’re looking forward to seeing you all there!

-Kate Lyons, COO

AnDevCon: That’s a Wrap

November 14, 2011

Apkudo

Last Wednesday I tweeted, “If you don’t leave a conference absolutely exhausted, you’re not doing it right. #AnDevCon”

I said it because the energy at AnDevCon’s was palpable and it took a lot for all of us at Apkudo to keep up! I’m sure we’ve all been to our fair share of boring, stiff conferences, but AnDevCon blew those shows out of the water. We can’t thank the conference organizers and attendees enough for allowing us to contribute to such an amazing show!

Here are a few of the highlights from AnDevCon:

Josh’s Lightning Talk about the Apkudo Test Platform was very well received. If you weren’t able to attend these Lightning Talks, check out Josh’s talk below.

*Note to self: next time use a tripod. :/

Buzz on the exhibit floor around the Apkudo booth:

If only we took more pictures! The energy around our booth was phenomenal. We met tons of people who asked really fantastic questions about the Apkudo Test Platform and our company. We came to the show with 450 t-shirts and gave away 429 of them on the first day. Within the first hour of the exhibit floor being open, we were flooded with developers wanting to speak with us and get a shirt! All for very good reason, too. Why?

The “Get Buzzed” t-shirts were your ticket to the Apkudo After Party at Knuckles Bar! This was definitely a lot of fun. We had an awesome time meeting and getting buzzed with all of the developers that came out to Knuckles. It was quite funny to see everyone wearing the same shirt, too.

Head over to our Facebook or Google+ pages to check out all of the photos!

All of that drinking left us thirsty for knowledge. Thankfully Apkudo CTO, Nicholas Fitzroy-Dale, was able to quench that thirst with a really engaging class about app testing methods called “Testing Sucks, But It Doesn’t Have To”. If you missed his presentation, you can listen to the (lo-fi) audio here:

Testing Sucks, But It Doesn’t Have To

It takes a bit of time to download, so please be patient! Just want the slides? Fair enough. Check them out on Slideshare.

Thanks again to everyone we met at AnDevCon, we had a blast! If you’re interested in a private beta invite or want to keep in touch, email us at sayhi@apkudo.com.

-Kate