WOW…

I woke up and saw the stats this morning and it’s clear that Android automation is what you all wanna read about.

DONE!
I’ll shelve the negotiation series and shift to sharing more of what I know about Robotium and automation in Android. Along with this I have some automation puzzles that I think will also help and challenge Android SDET community. So keep coming back and drop comments about things that you’d like to see.

P.S. I’ll also share tips and lessons using other frameworks too, namely UIAutomator, Espresso, and maybe MonkeyTalk.

P.P.S.S. (I never know if this is right…) Pictures and gifs are going to be a thing soon.

 

BOOM!

Robotium Tips Post

7 Random Robotium Tricks

I’ve been exploring and using Robotium for close to a year and here are some tips that I wish I had known when I started:

1.)  ArrayList<View> listOfTouchables = solo.getView(R.resource.id).getTouchables();

This is GREAT! I love it because, combined with the uiautomator tool included with the Android SDK, I can get views that don’t have text or a resource id. As long as the parent view has an id I can get to the view by traversing the ArrayList of touchables. I have found that it works quickly, and reliably.

2.) I had no clue that solo.waitForText () returns a boolean value. I know I could have stumbled on this sooner had I RTFM(Read The F#&*$@^ Manual), but another SDET showed me and it’s been a great way to condense code. The code is condensed because we can combine verification with controlling the flow of the tests without a heavy reliance on solo.sleep(Integer x).

3.) Use solo.searchButton(String x ) before you click on it with the resource id. In the event of an error, this has the benefit of letting you know the string that the automation was trying to find versus just the integer that gets returned if you use just the resource id. This also allows you to leverage the Robotium’s built in time out versus using solo.sleep(Integer x).

4.) Use solo.clickOnListItem(Integer x) is wonderful for selecting items in the navigation drawer. This has been great for me, especially when the items in the navigation drawer are shifting and more are being added. Combine this with the use of constants and you’ll have really easily manageable navigation drawer automation.

5.) Use solo.getCurrentActivity().hasWindowFocus() This little gem I stumbled on through Google and I had no clue how it would ever be useful. I was wrong and I’m sure a large numbers of applications that require automation will be able to use this puppy. It’s great for checking things that your application hands over to the Android OS via Intents. I use it because we have a few spots in our automation that open a URL in the browser. It’s great because I don’t honestly care if it actually opens in a browser, just that we’ve left the application and that’s what this does. One word of caution: If you’re using this with AppThwack your tests WILL timeout. So be careful when using it on their platform so as to not blow your minutes.

6.) This one is general, but the fact that Robotium is able to automate within webviews is great. The drawback is that it relies on the ids and if you’re leveraging an external API your automation can just break with very little to no notice and fixing it can be a bit painful. In my case I was using it with the Paypal API and we had a myriad of issues with the page not loading or not loading completely. This caused the test to be brittle and not really useful around that part. Don’t be discouraged though, because if you’re using an internally managed webpage this will be a great asset for end to end testing.

7.) I’m not sure how subtle I’ve been about this, but I HATE HATE HATE using solo.sleep() or any set time sleep in any automation framework. By this, I mean having a solo.sleep(40000) after clicking the a login button. I know there are a plethora of times where it’s easier, but it bugs me when I am forced to use it. I love Robotium because I have a ton of options to use without ever resorting to it. I know. I know. Anytime I use solo.waitForView, solo.waitForText or whatever else, under the hood we’re using sleep. The beauty of it being used there is that it’s abstracted from me. I don’t have to directly call it. It keeps my code looking slightly crisper. In the login example, a better option would be to use a solo.waitForView, with a timeout. This way if your login takes only 10 seconds, your test will progress sooner than waiting the additional 30 (and unnecessary) seconds. So, my last tip is that with Robotium you can wait for almost anything. You can solo.waitForView, solo.searchButton, or another of the myriad of options available in the framework. There are very few valid reasons to wait for a set amount of time, every single time.

BONUS: This was hard for me to find when I was starting off, and has been bookmarked since stumbling on it. I present to you the list of ALL the methods available within the Solo class.

ALL THE METHODS!!!

That’s all I have for today. The next post will be the first of three parts in the negotiation series. Feel free to comment, and you better share!

Upcoming posts…

I have few posts in the queue that I’m going to be releasing over the next couple weeks. I’m just taking time to polish them as I develop my stride, style, and voice.

The ones closest to completion are:
7 Robotium Tips & Tricks
-3 Powerful Negotiation Strategies (3     posts)

These are posts coming from life experiences (and in the case of negotiations,  failures :P) that I want to share, or at the very least, write down so I won’t forget them.

Thanks for reading and let me know if there are any other topics that you’d like to read about.

Thoughts on Integrity…

It’s a frequent message that honesty and business is a dangerous mix. That’s it’s more difficult to succeed if you’re being genuine and true to yourself. On the surface it makes sense, you can easily bring up the fact that compromise makes success more certain. I’d argue though, what is success? Are you actually successful if you don’t have your integrity with you? Are YOU actually successful if you can’t be yourself to get there?

This got me thinking about integrity and it’s place in business and life for that matter. In a world where a games-of-thrones political game can dictate how much money you make, people can and frequently resort to little finger tactics. It truly seems that all people that follow Ned Stark are doomed to his same fate. It’s my thought that it’s that integrity that gave Ned Stark his strength and helped build the fond memory that everyone has of him. His enemies respect him and his followers loved him. It’s hard not to. It’s the same way in life and business, when you are genuine, people are drawn to you. I remember when reading “The Prince” Machiaveli talks of ruling through fear and the effort that’s required to keep a state under control. You have to be dedicated to use fear (as well as deceit), where as you just have to be yourself when you’re genuine. It’s easier to maintain an internal truth than it is to perpetrate a lie.

This extends to delivering bad news. I would historically hold onto bad news and push as hard as I could to fix the bad news so when it came to reporting the issue it would be in past tense. My supervisors and customers loved this, but the result is that I was burned out fixing other people’s problems. This isn’t to say don’t be a team player, but when you’re ALWAYS fixing the issues in the background without letting your customers know what’s going on they get a false perception of what’s going on. Not to mention it could leave them with a perspective that you’re not doing YOUR job. It’s just better for them to know. That being said, don’t just pass on problems. What you want to do is pass on problems with a few solutions. This has the benefit of you being honest with sharing your thought process through the solutions. It also shows integrity.

What is integrity? To me, it’s when a person is brave enough to face a shortcoming with honesty. When a difficult problem is presented they do what is ethically and morally right despite the possible costs. It’s this bravery that inspires other people to follow suit. At the end of the day that’s what all leaders should aspire to do. That’s my thoughts on integrity and leadership.

Last thought: By posting this I’m not attempting to say that I have perfect integrity. I don’t. At all. What I do have is an internal commitment to try to bring that bravery to every situation. That’s what I think is all that’s needed. That dedication to try to do what’s right. It’s hard, especially when your voice is outnumbered, but it’s at those points it’s most critical to voice your dissention.

Ok now I’m done for reals… lol

ELATIONS!!!111@!!!@2one one EXclaMaTion poiNt!!!1

I’ll be teaching at the University of Washington starting in March (2015) for 10 weeks. I’m super stoked about the opportunity and excited about the chance to share my love of Android with a room full of students. I’ve nearly completed my syllabus and I’ve already plotted out the homework assignments, final project, and quizzes. It’s safe to say I’ve geeked out on this. XD

Sophie’s Choice…

My kids are asleep and I have free time…

aaaaaannnnnddddd

I’m researching ways to make my functional automated testing more performant with Robotium. This might just be me, but when I use the solo.clickOnText(String x) and solo.clickOnButton(String x) are faster than solo.clickOnView(solo.getView(R.id.name)). I prefer to use the latter because I feel it helps me guarantee that I’ll hit the right button, but the clickOnButton() method is my lazy favorite because it goes faster. It also has the added benefit of a decent log message when it can’t be found. It’ll say something like “Button with text ‘x’ can’t be found.” versus “View with id ‘939494949729’ can’t be found.” The problem with using the text is that content changes OFTEN in development. This means added maintenance in order to avoid false failures. In my opinion the best tests are the ones that you only have write once. That means making it as generic as possible for most of the visual interaction. You don’t want your tests to hinge on something as volatile as the content. That’s what I’m noodling through tonight…

Should I choose the path with frequent maintenance, and gain speed or should I choose the path of low maintenance and lose speed?

That’s MY Clique

If every nigga in your clique is rich, your clique is rugged
Nobody will fall cause everyone will be each others crutches

Yesterday, I shared the basics of Hux with a friend and developer. I was nervous, as I always am when I share the premise behind Hux. It’s my baby. I’m not too afraid of someone stealing it as much as I am about someone thinking it’s a lame idea. It’s a constant feeling among new entrepreneurs and some old. What’s lost when when you hide your idea is that you miss out on the chance to make your idea better. Every person you introduce your idea to is going to have a thought about it, and it’s best to get the feedback now versus when you have deadlines and expectations. It’s cheaper to pivot when you’re in the idea phase than it is when your release is hours away, or when you have millions of dollars from investors already spent. (Those helicopters won’t buy themselves…)

The second part is that by sharing your ideas with other people, especially other entrepreneurs, you help make the community stronger. That’s why most VCs want founders to have a team. It not only shows the ability to sell other people on your idea, it shows greater creative potential. When an idea only has to make it through YOUR checklist to be created there’s a ton of things that will be missed, versus the amount of things that’d be missed if you added just two more people before implementation. The start will be slow, this is normal. As the team filters out ideas they’ll become attuned to the frequency of the project and soon they’ll start humming along. The review process will pick up, but if they’re a good team they’ll keep each other honest. Honesty is a powerful thing for a startup. It’s best if it starts with the higher ups, with the core team, because when the customer is honest, they’re WAY louder. When the tech writers are honest, they’re (usually) not going to be giving you constructive criticism. That is why the core team HAS to be tight and honest.

The last part is that as a team when you’re knocking off competition it builds up the team. Harry, Hermione, and Ron weren’t friends until AFTER they knocked out a mountain troll together (I’m a nerd, sue me). It takes battles and fires to properly forge a sharp team. Once together it takes honesty to keep it together. As you and your team are taking on the world, which is what we’re all doing, you will each gain strengths. Share those strengths and insights with the team, the team then will gain some of those strengths, which will pass on to the project. So, all this to restate what Jay-Z said at the top. When your team is strong, it’s way better than just YOU being strong.

I hope you fools choose to listen…

Breathing different

After knocking out some laps I felt tired, but good. I also felt like I deserved some time in the hot tub. I got in and there were a good mix of people and I just got into my head thinking about posts and Hux. Then as if waiting for some signal everyone left and it was just me. That’s cool with me but I did sniff under my arms to see if I was the smelly kid. After a while an east African family came in. I stopped sniffing and relaxed. I instantly felt comfortable.  I felt at home. I had this feeling once before in Seattle when I went to a Senegal naming party. I just forgot about something and felt so relaxed so at home. I started to breathe different. It’s hard to describe,  but my whole demeanor just eased. That happened again today. I am generally comfortable in almost any group of people, but around my people I’m something more. It’s so hard to explain, but something just clicks and I’m a part of something that I wasn’t moments before. Something bigger. Without them saying anything I feel accepted and not judged. I feel like they too are breathing different. This is a different kind of post and a hard one to articulate,  but I wanted to share it.

Swimming lessons…

Today I was swimming and getting back into doing laps. It’s been a while since I got to the gym and even longer since I got in the pool. I love swimming because as a father of three it’s guaranteed quiet time. It leaves me alone with my thoughts. Today, as always, I set goals for my breaths. I usually try to make it 12.5 m before taking a breath. Without fail everything is fine until I am one stroke from crossing the mid line and I freak out and NEED to breathe. I take the breath, which is usually a shallow one, and freak out again near the end of the pool. What hit me today is the realization that I don’t really need the breath. I’m just freaking out because I’m close to my goal and panic grabs me. This is something that happens in different parts of my life. Things are going fine and then I wig out when I’m close to crossing a checkpoint. Today though, armed with this knowledge,  I made it over the mid line controlling my panic and also my breath. The key is to relax and then react. Reacting without relaxing first is hazardous and may cause you to make shallow, ineffective actions. That’s all I got for today.

“Just keep swimming…” Dori