Logs are empty when using Spoon gradle with Robotium

181 views Asked by At

I am using spoon gradle with robotium and cucumber and I can take the screenshots and see on the report, but the logs are completely empty. Am I missing something ?

My Build.gradle:

 classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.3') {
  exclude module: 'guava'
  }

 classpath 'com.squareup.spoon:spoon-runner:1.2.0'

My app-build.gradle:

dependencies{
 androidTestCompile 'com.squareup.spoon:spoon-client:1.2.0'
 androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.5.1'
}

spoon {
 debug = true
 if (project.hasProperty('spoonFailNoConnectedDevice')) {
    failIfNoDeviceConnected = true
 }

 if (project.hasProperty('cucumberOptions')) {
    instrumentationArgs = ["cucumberOptions=" + "'${project.cucumberOptions}'"]
 }

}

I am running through commandline, the command is:

gradle spoon -PspoonFailNoConnectedDevice -PcucumberOptions='--tags @smoke'

My instrumentation runner:

public class Instrumentation extends CucumberInstrumentation {
@Override
public void onStart() {
    runOnMainSync(new Runnable() {
        @Override
        public void run() {
            Application app = (Application) getTargetContext().getApplicationContext();
            String simpleName = Instrumentation.class.getSimpleName();

            // Unlock the device so that the tests can input keystrokes.
            ((KeyguardManager) app.getSystemService(KEYGUARD_SERVICE)) //
                .newKeyguardLock(simpleName) //
                .disableKeyguard();
            // Wake up the screen.
            ((PowerManager) app.getSystemService(POWER_SERVICE)) //
                .newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE, simpleName) //
                .acquire();
        }
    });

    super.onStart();
}

}

and just the logs are empty, what could be ? someone have an idea ?

Thank you !

1

There are 1 answers

2
WenChao On

Hi I have created a sample project here that fixes the empty log issue. Basically you need to write a custom Reporter to trigger the Spoon logging.