LinkedIn Open-Sources Tools for Android Developers

LinkedIn open-sourced two tools to help Android developers to better test and enable users to report bugs in their applications.

Mobile app dev

LinkedIn continues to open-source core technologies to help developers and IT staff better build and manage applications, this week delivering two Android-based tools to the community.

The first is Shaky, an Android shake-for-feedback library that enables Android device users to shake their phones to report bugs in features and applications.

In the past year, LinkedIn employees used Shaky to report more than 5,000 internal features and bugs to the company's developers. Now LinkedIn is making the technology available to the community at large so any developer can implement it for users to report bugs in their applications.

Shaky was heavily inspired by the shake-to-send-feedback feature in Google Maps, Nick Aversano, a LinkedIn software engineer who worked on the project, wrote in a blog post. Shaky uses Square's Seismic to detect device shakes and initiate feedback from users.

"While there are more robust closed-source solutions, we wanted to create a simpler and extensible alternative," he said.

Aversano said LinkedIn releases new versions of its applications internally to employees before delivering them to the external user base of LinkedIn members. Some bugs are simply difficult to expose until an app is used by enough people, he said. And often it is the company's employees that find bugs that the LinkedIn developers miss.

However, prior to the release of Shaky, a LinkedIn employee that found a bug would have to create a ticket to report it. Because this process was awkward on a mobile phone, LinkedIn created Shaky to make it easier to report bugs, thus encouraging them to do so.

"We needed a seamless way for employees to report their findings within our new mobile app," Aversano said.

Now, users don't have to navigate away from the screen where things went wrong, he said.

"When a user shakes their device, Shaky automatically captures relevant app information, including: a screenshot, a log, and the most recent pages the user visited," Aversano said. "Shaky also provides an API that can be extended to capture even more app-specific information. With just a few lines of code, developers can get their own feedback reporting flow. This includes the initial dialog, the type of feedback, a screenshot of the app (which users can draw on to show what's wrong), and a submission form that asks the user to describe the bug."

Aversano also noted that Shaky has two primary users: people who interact with the UI, and developers who implement the API.

"With Shaky, implementing your own shake-for-feedback form is a breeze," Aversano said.

Meanwhile, LinkedIn also this week open-sourced Test Butler, a new suite of tools for doing large-scale UI testing for Android. It solves one of the biggest pain points in application development for Android and is something any mobile developer should use to test apps moving forward, Drew Hannay, a LinkedIn staff software engineer who created the project, said in a blog post.

Hannay noted that automated testing is a key component of LinkedIn's 3x3 strategy for releasing mobile applications. The 3x3 strategy is LinkedIn's continuous integration/continuous delivery commitment to release code three times per day, with no more than three hours between when code is committed and when that code is available to employees.

There are two primary reasons LinkedIn adheres to the three-hour schedule. One is that three hours is not enough time to conduct any manual testing steps, Hannay said. So automation is key. The other reason is that three hours is not enough time to test everything end-to-end.

"We prefer an approach where product owners decide which production-critical paths require UI tests, and resolve some of the edge/negative cases with unit tests, which are much faster and easier to maintain," Hannay said in a separate post on the 3x3 strategy. To achieve its goal, LinkedIn needed a complete automation pipeline for every step, from code commit to production release, he said.

However, when LinkedIn began developing its new Android app, the company found that its testing environment was unreliable and the tests failed intermittently. "We needed a solution that would let us rely on our tests to inform us when there was a problem with the app, not the testing environment," because UI testing on Android can be unstable for a variety of reasons, Hannay said.

To get around the instability, LinkedIn created Test Butler, which includes a standard, stable Android library along with a companion Android app apk (Android Application Package) that developers can install on their Android emulator before running tests. This makes UI testing more reliable by providing signature-level permissions, disable crash and App Not Responding (ANR) dialogs, disabling animations and locking the screen, WiFi radio and CPU so they don't go to sleep and cause test failures.

Hannay said Test Butler has been released under the Apache 2.0 license and the code is available on GitHub.