Ranorex v9.5の新機能(Self-Healing機能)

2021年7月8日に、国内リリースされた Ranorex バージョン 9.5で、新たにSelf-Healing機能が追加されました。新たに搭載されたSelf-Healing機能では、1つのオブジェクトに対し、RanoreXPathとは別に、もう1つのパス情報(堅牢性重視型のRanoreXPath)を保持することで、テスト実行時にRanoreXPathにてオブジェクトが検出できなくても、もう1つのパス情報を使用してテストの続行を可能とします。
設定方法
① Ranorex Studioにて設定ボタンをクリックします。

② 詳細タブを選択し、高度な設定をクリックします。

③ RanoreXPath生成モードを Robust RanoreXPath(new) に変更します。

この設定をおこなうことでSelf-Healing機能が有効となり、Ranorexでオブジェクトのパス情報を取得した時に、RanoreXPathとは別に、堅牢性重視型のRanoreXPathを保持します。
Webアプリケーションを使用した例
Webアプリケーションを使用した、Self-Healing機能の利用例をご紹介します。
① Ranorex Studioで、下図のようなアプリケーションの[発送オプション]をクリックする操作をレコーディングします。

取得したリポジトリアイテムのプロパティで、オブジェクトのRanoreXPath(Absolute Path)と、Self-Healing機能により取得した堅牢性重視型のRanoreXPath(RobustPath)を確認できます。
- RanoreXPath(Absolute Path): /dom[@domain=’localhost:38080′]//div[#’spc-orders’]/div/div/div[3]/div/div/div[2]//fieldset/div[1]/input[@name=’option’]
- 堅牢性重視型のRanoreXPath(RobustPath): /dom[@domain=’localhost:38080′]//div[#’spc-orders’]//input[@name=’option’]

② 画面レイアウトの変更により、[発送オプション]ボタンの位置が変更となった場合、下図の例ではオブジェクトのdom情報(RanoreXPathの構成)も変更されます。

画面レイアウトの変更前と比較すると、RanoreXPath(Absolute Path)は異なりますが、Self-Healing機能により取得した堅牢性重視型のRanoreXPath(RobustPath)は同じであることが確認できます。
- RanoreXPath(Absolute Path): /dom[@domain=’localhost:38080′]//div[#’spc-orders’]/div/div[2]/?/?/fieldset/div[1]/input[@name=’option’]
- 堅牢性重視型のRanoreXPath(RobustPath): /dom[@domain=’localhost:38080′]//div[#’spc-orders’]//input[@name=’option’]

③ 画面レイアウトが変更された②のWebアプリケーションを使用して、①でレコーディングしたRanorexのテストを実行します。
④ 画面レイアウトの変更前と変更後でRanoreXPathが異なるので、本来であればテストを実行した時にオブジェクトが見つからずにエラーとなりますが、RanoreXPathの代わりに、堅牢性重視型のRanoreXPath(RobustPath)が使用されることでオブジェクトが検出され、テストが成功します。
テスト結果のレポートには、堅牢性重視型のRanoreXPath(RobustPath)を使用した内容を表すメッセージが出力されます。

※Self-Healing機能を利用しない(堅牢性重視型のRanoreXPathを取得しない)場合、設定されているRanoreXPathではオブジェクトが検出できず、”Failed to find item” エラーが発生します。

まとめ
本記事では、Self-Healing機能についてご紹介しました。Self-Healing機能を使用し、1つのオブジェクトに対して通常のRanoreXPathと堅牢性重視型のRanoreXPathの2つのパス情報を保持することで、予期しないエラーでテストが中断されることを回避し、より安定したテストを実行することが可能となります。
・ユーザーガイド:設定 – セルフヒーリング
Self-Healing 機能の詳細は、以下の資料にて紹介しております。