[Android] How can I run cucumber in AndroidStudio

621 views
Skip to first unread message

Rafaela Souza

unread,
Oct 6, 2015, 5:47:55 AM10/6/15
to Cukes

Hi guys,


AndroidStudio just released a new version that supports cucumber plugin. Now, I am trying to config, but it seems that I am missing something. Someone can help me please ?

My config:



Thank you !

My instrumentantion:


import android.app.Application;
import android.app.KeyguardManager;
import android.os.PowerManager;

import cucumber.api.CucumberOptions;
import cucumber.api.android.CucumberInstrumentation;

import static android.content.Context.KEYGUARD_SERVICE;
import static android.content.Context.POWER_SERVICE;
import static android.os.PowerManager.ACQUIRE_CAUSES_WAKEUP;
import static android.os.PowerManager.FULL_WAKE_LOCK;
import static android.os.PowerManager.ON_AFTER_RELEASE;


//@CucumberOptions(features = {"features"}, tags = {"@debug"})
@CucumberOptions(features = {"features"}, plugin = {"pretty"}, tags ={"~@pending", "~@manual", "~@reboot"})
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();
}

}

Björn Rasmusson

unread,
Oct 6, 2015, 6:30:35 AM10/6/15
to Cukes
Rafaela Souza wrote:

Hi guys,


AndroidStudio just released a new version that supports cucumber plugin. Now, I am trying to config, but it seems that I am missing something. Someone can help me please ?

Hi,

I do not use AndroidStudio myself, so the best I can do is to point at the AndroidStudio-example-project in the Cucumber-JVM repo (developed for a earlier version of AndroidStudio I believe).

Best Regards
Björn
 
Reply all
Reply to author
Forward
0 new messages