2016-10-25 6 views
0

私のカラバッシュテストを実行するとき、私は起動しようとしているアンドロイドにバックドアメソッドを持っています。バックドアを使用してAndroidをテストしています。メソッドが見つかりません

バックドアメソッドは、calabash-androidドキュメントで提案されているように、Applicationサブクラスにあります。

https://developer.xamarin.com/guides/testcloud/calabash/working-with/backdoors/

しかし、私は次のエラーを取得する:

Error: {"result"=>"No such method found: setTestToken:([String])", "outcome"=>"ERROR", "details"=>"{receiverClass=com.test.mobile.ui.MainActivity, error=No such method found: setTestToken:([String]), [email protected], methodName=setTestToken:}"} 

MainActivityは、現在の活動です。

現在のアクティビティにアクセスするのではなく、アプリケーションサブクラスでメソッドを実行するにはどうすればよいですか?

これらのコマンドを呼び出すことを推奨する別の質問の回答は、コマンドと出力です。

query("* index:0"): 

"class" => "com.android.internal.policy.PhoneWindow$DecorView", 

query("* index:0", :getContext, :toString) 

[email protected] 

query("* index:0", :getContext, :getApplicationContext, :toString) 

[email protected] 

また、この方法は、次のようになります。

public String setTestToken(String token) { 
    if (DEBUG) { 
     DefaultPreferences.getInstance().edit().putTestToken(token).commit(); 
    Logger.d(TAG, "Test token set: " + token); 

    //This is a return for Calabash so that it knows the token has been set. 
    return DefaultPreferences.getInstance().getTestToken(); 
    } 
    Logger.d(TAG, "Test token not set"); 

    //This is a return for Calabash so that it knows the token has not been set. 
    return null; 
} 

ひょうたんから呼び出しは次のようになります。

backdoor('setTestToken:', token) 

答えて

0

のiOSは、このようなバックドアを呼び出します。

backdoor('setTestToken:', token) 

Androidはこのようにバックドアを呼び出します:

backdoor('setTestToken', token) 

Androidの問題を解決したコロンを削除しました。

iOSにはコロンが必要です。

関連する問題