1 / 14

Mining Parametric Specifications

ICSE2011 勉強会 セッション: Testing the Water Ⅲ. Parametric Specifications の(自動)抽出. Mining Parametric Specifications. Choonghwan Lee, Feng Chen, Grigore Rosu ( イリノイ 大学). 担当: NTT データ 朱峰錦司. 前提知識. “ Parametric Specifications ” とは? 形式的 な仕様記述の一種 実行 時のパラメータ(具体的なオブジェクト) に着目. ユーザ:「 next しても大丈夫か?」

gil
Download Presentation

Mining Parametric Specifications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ICSE2011勉強会セッション: Testing the Water Ⅲ Parametric Specificationsの(自動)抽出 Mining Parametric Specifications Choonghwan Lee, Feng Chen, GrigoreRosu (イリノイ大学) 担当: NTTデータ 朱峰錦司

  2. 前提知識 • “Parametric Specifications”とは? • 形式的な仕様記述の一種 • 実行時のパラメータ(具体的なオブジェクト)に着目 ユーザ:「nextしても大丈夫か?」 hasNext:「大丈夫だ、問題ない。」 JavaのCollectionとIteratorクラス 「神は言っている…ここでCollectionを操作する定めではないと…」 図表はMining Parametric Specifications(ICSE 2011) P.591より引用

  3. 目的と貢献 • 問題 • Parametric Specificationsは作成が難しい • 形式仕様をminingする研究は様々あるが、(満足のいく)Parametricなものを抽出できるものはない • 複数のオブジェクトが絡むと解析が複雑になる • 本質的な部分のみを切り出すSlicingも難しい • 貢献 • 提案手法を“JMINER”というツールとして実現 • mining対象のUnitTestCaseと実行系列があれば、mining処理の100%自動化が可能 汎用的で本質的なParametric Specificationsを抽出する技法の提案

  4. 提案手法の概要 1. メソッドと関連するクラスのセットを抽出 (outputイメージ) <{add, iterator, hasNext, next}, {Collection, Iterator}> 2. 異なるオブジェクトセットの系列を分離 3. 分離された系列からFSAを生成 図表はMining Parametric Specifications(ICSE 2011) P.591-593より引用

  5. 手法の評価 • 題材 • JMINERを用いてOpenJDK6の4つのパッケージをmining • java.util, java.io, java.lang, java.net • 実行系列取得にはDaCapo benchmark suiteとApache JAMES Serverを使用 • 評価観点と結果 • Miningに要した時間 • わりと現実的な時間で実施可能 • 系列に含まれるevent数が多ければ多いほど、時間がかかってしまうが、得られる出力の品質が高いので大きな問題ではない • 出力されたParametric Specificationsの妥当性 • 例を4つ上げており、全てについて結果はおおむね妥当 • 手法の特性上、制限もあり • 使用するサンプルに依存してしまう • FSAなので「カウンタ」の概念がない 順不同のはず 順不同のはず hasMoreTokensを用いずカウンタで制御 図表はMining Parametric Specifications(ICSE 2011) P.598-599より引用

  6. ICSE2011勉強会セッション: Testing the Water Ⅲ モデル操作のFootprintを推定する Estimating Footprints ofModel Operations CédricJeanneret, Martin Glinz (スイス・チューリッヒ大学) Benoit Baudry (フランス・IRISA) 担当: NTT研 張暁晶

  7. 目的と貢献 モデル 使われた部分 • Footprintとは何か • モデルへの操作において、実際に「使われた」モデル要素の集合 • モデル操作にはクエリ、シミュレーション、ビュー生成、モデル変換等がある • Footprintが判ると何が嬉しいか • 問題の特定 • Footprintが期待する内容やサイズとなっているかを観察することによって、「モデル」と「操作」の改良点を見つけられる • モデルのスコープや抽象度、目的は適切か? • 他のモデル要素をも読むことで、操作を高度化できないか? • インパクト分析 • Footprint算出時に作られるモデルの「ビュー」と、操作の「戻り値」との間の相互の影響を把握できる • Footprintを求めるうえでの問題点 • 計算コストが高い。操作を実行するのと同じだけの計算コストがかかる • 操作を実行することなくFootprintを推定する手法を提案 ある操作の”Footprint” 貢献:モデル使用状況を知るための効率的かつ精確な手段を提供した

  8. 手法の説明 メタモデル モデル 操作 発火可能な遷移の名前を全て取り出す Petrinet :: namesOfEnabledTransitions(): Set(String) body: self.transitions −> select(t:Transition | t.enabled) −> collect(t:Transition | t.name) Step1操作の「定義」を分析して「メタモデル」のどこを使っているかを抽出 Dynamic Footprint(従来手法) Static Footprint(提案手法) モデル上のfootprint メタモデル上のfootprint Step2Step1で得られたメタモデル要素のインスタンスであるような、モデル要素だけを集める Cedric Jeanneret, Martin Glinz, and Benoit Baudry. Estimating footprints of modeloperations. In International Conference on Software Engineering (ICSE 11), 2011.Figure 2, 3, Table 1 より引用

  9. 評価方法や評価結果 Objects,Settings両方とも精確に推定できるケースが多い • 評価方法 • 75個のモデルと6種の操作を用いて実験 • 評価結果 • 提案したStatic Footprintは… • 適合率Dynamic Footprintに対して精確に推定できている • 計算速度Dynamic Footprintより計算が速い Settingsがイマイチなケースもある Cedric Jeanneret, Martin Glinz, and Benoit Baudry. Estimating footprints of modeloperations. In International Conference on Software Engineering (ICSE 11), 2011.Figure 9, Table 4 より引用

  10. ICSE2011勉強会セッション: Testing the Water Ⅲ テストを自動生成できなかった原因を特定する Precise Identification of Problems for Structural Test Generation Xusheng Xiao, Tao Xie(ノースカロライナ大学) Nikolai Tillmann, and Jonathan de Halleux (Microsoft Research) 担当: NTT研 丹野治門

  11. 目的と貢献 • 目的 • テスト生成(テストデータ生成)でより高いカバレッジを実現する • 現状の問題点 • ツール(例えば,PEX)でテストを自動生成できないパスがある • 提案 • ツールで生成できなかった原因を特定し,人が補助してテストを生成する … if ( … ){ … } else{ … } … External-Method-Call Problem(EMCP) Object-Creation-Problem (OCP) ※ツールで生成できない原因の65%を占める ツールの 未到達箇所! 原因特定, 分類する OCPか.じゃあ,このFactory Methodを使うようツールに指示してみよう 貢献:ツールと人の協調でカバレッジを上げる初の試みであり,そのために必要な原因(EMCP,OCP)の特定手法を考案

  12. External-Method-Call Problem(EMCP)の特定 • 手順 • 未到達箇所の直前までの外部ライブラリメソッド呼び出しEMCP候補 • EMCP候補の中で未到達箇所の直前の分岐条件とデータ依存関係にあるメソッドEMCP特定 XUnitの例(C#) static string GetDefaultConfigFile(string assemblyFile) { string configFilename = assemblyFile + ".config"; Console.WriteLine(“…searching ” + assemblyFile); bool exists = File.Exists(configFilename); if (exists) return configFilename; return null; } EMCP候補 ・Console.WriteLine ・File.Exists 絞り込み 未到達箇所 EMCP特定 ・File.Exists Xusheng Xiao, Tao Xie, Nikolai Tillmann, and Jonathan de Halleux“Precise Identification of Problems for Structural Test Generation” In International Conference on Software Engineering (ICSE 11), 2011.Figure 1 より引用(一部修正有り)

  13. Object-Creation Problem(OCP)の特定 • 手順 • メソッドの引数(及びそのフィールド)OCP候補 • OCP候補の中で未到達箇所の直前の分岐条件とデータ依存関係にあるメソッド引数(もしくはそのフィールド)OCP特定 Stackを用いたFixedSizeStackの実装例(C#) OCP候補・FixedSizeStack (引数this)  ・FixedSizeStack.stack ・Stack.items (直接代入不可)    ・items._size (直接代入不可) ・object (引数item) public class FixedSizeStack { private Stack stack; public FixedSizeStack(Stack stack) { this.stack= stack; } public void Push(object item) { if(stack.Count() == 10) { throw new Exception("full"); } stack.Push(item); } ... } 絞り込み ※直接代入不可の場合はメンバとしてもつクラスをOCPとして選ぶ OCP特定 ・FixedSizeStack.stack 未到達箇所 Xusheng Xiao, Tao Xie, Nikolai Tillmann, and Jonathan de Halleux “Precise Identification of Problems for Structural Test Generation” In International Conference on Software Engineering (ICSE 11), 2011.Figure 2 より引用(一部修正有り)

  14. 評価 • 対象 • XUnit(8.3KLOC),Quick Graph(11.4KLOC) 高い正解率 (False Positive, False Negativeが少ない) 97.33%除外 65.63%除外 絞り込み(候補→特定)の効果 データ依存関係を利用した絞り込みは効果があり高い正解率となった Xusheng Xiao, Tao Xie, Nikolai Tillmann, and Jonathan de Halleux “Precise Identification of Problems for Structural Test Generation” In International Conference on Software Engineering (ICSE 11), 2011.Table2, Table3 より引用(一部修正有り)

More Related