2015-10-06 56 views
2

我正在使用勺子gradle與robotium和黃瓜,我可以截取截圖並在報告中看到,但日誌完全是空的。我錯過了什麼嗎?當使用Robotium的勺子gradle時,日誌爲空

我的build.gradle:

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

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

我的應用程序 - 的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}'"] 
} 

} 

我通過命令行運行的命令是:

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

我的儀表亞軍:

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(); 
} 

} 

只是日誌是空的,可能是什麼?有人有一個想法?

謝謝!

回答

1

嗨我已經創建了一個示例項目here修復空日誌問題。基本上你需要寫一個自定義的Reporter來觸發勺子日誌記錄。

+0

可以分享嗎? – Caipivara

+0

@Caipivara,你可以看看https://github.com/cooperkong/ACucumberSpoonScreenshots – WenChao

相關問題