私は先週、この問題について頭を悩ませてきましたが、他に頼る場所がありません。現在、Instruments でテストを実行すると、ほとんどの場合、成功/失敗のログ機能によって次のように報告されます。
問題: このテストを終了することを明示せずにスクリプトが終了しました
注 -- はい、スペル ミスは正しいです
しかし、私のロギング方法は正しいです。また、テストに変更を加えて、おそらく余分な空白やコメントを追加してから保存して再度実行すると、合格/不合格機能が実際に一度だけ機能します!
ただし、同じコードを変更せずにすぐに再度実行すると、Issue: Script ended without explicting closing this test
問題が再び発生します。
それは腹立たしいです!
私のテストコードの要約例を次に示します。
var target = UIATarget.localTarget();
var app = UIATarget.localTarget().frontMostApp();
var testName = "LoginCreateEntry";
//Start test logging
UIALogger.logStart(testName);
//**Do UI automation stuff here generated by Instruments/record**
//The automation creates a list entry in my application
//The flow goes, run the automation that creates the entry, then verify that the entry
//got created as expected and is visible to the user in the iPhone interface.
var window = app.mainWindow();
var tableView = window.tableViews()[0];
var tableGroup = tableView.groups()[0];
var entryName = "My Dogs!";
var myEntry = tableView.cells()[0].name();
//Do a bunch of UI automation here to create my entry, which results in the entry
//appearing in the mainWindow with the label: My Dogs!
//Get the value held in myEntry to print to the log so that I know
//the variable has a value in it to evaluate
UIALogger.logMessage("My Story Title: " + myEntry);
//If myEntry evaluates to true, then call this test a pass.
if (myEntry === entryName) {
UIALogger.logMessage("My entry was created!");
//Mark the test as a PASS
UIALogger.logPass(testName);
}
else {
UIALogger.logMessage("My entry was not created!");
//Mark the test as a FAIL
UIALogger.logFail(testName);
}
//End test
前述のように、このコードを実行すると、次のようになります。
問題: このテストを終了することを説明せずにスクリプトが終了しました
しかし、2 つ目のlogMessage()
メソッドを追加したり、スクリプトに変更を加えたり、コメントを追加したり、これらの変更を保存してから再度実行したりすると、1 回の実行で成功/失敗が機能する可能性が 80% になります。しかし、コードを変更せずにすぐに再度実行すると、怒り狂った " Issue: Script ended...
" 動作が再び発生します。
私はここで機知に富んでいます。ヘルプやフィードバックをいただければ幸いです。
また、ここで報告されているように、これと同じ問題が他の人によっても経験されています: Instruments Automation Tool: Script Ended Without Explicitly Closes This Test
- - - - - - - - - - -アップデート - - - - - - - - - - - - - -
Xcode 4.6 を実行している別の MacBook Pro でこの問題を再現しました。また、意図的にテストを失敗させるためにさまざまな努力をしました。反応を得るためだけですが、まだIssue: Script ended without expliciting closing this test
ログメッセージを取得しており、条件が読み取られていない可能性があることを示しています。それでも、スクリプトに小さな変更を加えてから、これらの変更を保存して再度実行すると、パス/フェイル機能が 1 回の実行で機能する可能性が高くなり、「問題: スクリプトが終了しました.. ." スクリプトを変更しなくても、次回の実行時に再び動作します。
----------------------更新×2-------------------------- --
発火していないように見えるのは IF ステートメントであり、ブレークポイントを使用してこれを確認することさえできません。しかし、私は次のような簡単なテストを実行しました:
UIALogger.logStart();
if (5 < 10)
{
//Mark the test as a PASS
UIALogger.logPass();
}
else
{
//Mark the test as a FAIL
UIALogger.logFail();
}
それでも得たIssue: Script ended without explicating closing this test
----------------------更新×3-------------------------- --
そのため、Instruments でまったく新しい別のスクリプトを作成し、以下のコードのみを使用して、IF
ステートメント内の相対値をどのように変更しても、合格/不合格が常に機能するようになりました。うわー、これはますます奇妙になってきています。
var target = UIATarget.localTarget();
UIALogger.logStart();
if (5 > 10)
{
//Mark the test as a PASS
UIALogger.logPass();
}
else
{
//Mark the test as a FAIL
UIALogger.logFail();
}