Site Loader
Auckland, New Zealand
In this post we will discuss one of the coolest and most useful testing behavior called distributed testing of application in Android. Well, many of readers like you have been asking this to me and this is the answer for your question, Spoon!!


Android’s ever-expanding ecosystem of devices creates a unique challenge to testing applications. Spoon aims to simplify this task by distributing instrumentation test execution and displaying the results in a meaningful way. Spoon makes existing instrumentation tests more useful. Using the application APK and instrumentation APK, Spoon runs the tests on multiple devices simultaneously. Once all tests have completed, a static HTML summary is generated with detailed information about each device and test.

Spoon Components

Spoon has only two components which are basically JAR files you can download from here
  • Spoon Runner
  • Spoon Client library
Spoon client library jar file need to be added in our AUT or Test project for taking screenshots, whereas runner is responsible for running the test in multiple devices.

Spoon Command to run the test

java -jar spoon-runner-1.1.10-jar-with-dependencies.jar \
    --apk Calculator.apk --test-apk calculatortest.apk

Html Report

The HTML report generated by spoon test runner will look something like this shown below

Figure 1: Initial Spoon Report

Figure 2: Detailed Report

Figure 3: Device Log

Here is the complete video for the above discussion Here the complete code of the above video
	public void testDialog() throws Exception {
		// Declare all the controls to perform operations
		Spoon.screenshot(solo.getCurrentActivity(), "initial_state");
		EditText txtVal1 = (EditText) solo.getView(;
		EditText txtVal2 = (EditText) solo.getView(;
		RadioButton rdbtnMul = (RadioButton) solo.getView(;
		TextView viewResult = (TextView) solo.getView(;

		// Enter Text in the control
		Spoon.screenshot(solo.getCurrentActivity(), "Before_text1");
		solo.enterText(txtVal1, "12");
		Spoon.screenshot(solo.getCurrentActivity(), "Before_text2");
		solo.enterText(txtVal2, "12");

		// check for the result
		Log.d(TAG, "Checking for the results");
		if (viewResult.getText().toString().equalsIgnoreCase("24"))
			Log.d(TAG, "ADD PASSED");
			Log.d(TAG, "ADD FAILED");

		// Click multiply
		Spoon.screenshot(solo.getCurrentActivity(), "Before_MultiplyRadio");
		Spoon.screenshot(solo.getCurrentActivity(), "After_MultiplyRadio");

		// Verify Multipy stuffs
		if (viewResult.getText().toString().equalsIgnoreCase("144"))
			Log.d(TAG, "MUL PASSED");
			Log.d(TAG, "MUL FAILED");

		Spoon.screenshot(solo.getCurrentActivity(), "final_show");
Thanks for reading the post and watching the video !!! Please leave your comments and let me know if there is anything I should update in this post. Thanks, Karthik KK

Post Author: Karthik kk

One Reply to “Distributed test execution in android with Spoon”

  1. Hi,
    I am able to take screenshots of the tests using spoon with android version below 5.0 but whenever I try to run it on devices above the specified version, the app gets installed into the device but when it comes to the screenshot line it gets closed and the test passes without any log error. And this is the log error when I connect only one device of android version 4.4.2.
    [SR.runTests] Executing instrumentation suite on 1 device(s).
    Exception in thread “Thread-1” java.lang.IllegalStateException: No logcat header processed yet, failed to parse line: ——— beginning of /dev/log/system
    2016-06-13 18:13:58 [SDR.handleFiles] Found class name dirs: []

    This is the way I take screenshot in my application.
    Spoon.screenshot(solo.getCurrentActivity(), “Before_text1”);

    Can anyone tell me if I need to give special permissions for these devices to obtain the screenshots??


Leave a Reply

Your email address will not be published. Required fields are marked *