test-to-code traceability
traceability の応用として unit test は code example として優れているよということを示すユーザー実験をやったよ
Bouillon et al. implemented a JUnit Eclipse plugin with static call graphs per test cases to help developers indicate the intended units under test 7. Furthermore, they raise this traceability link from inside a comment string to the program itself by using a Java annotation construct. Their main goal lies in pinpointing error locations in production code as a result of a failing test.
git とかのログから対応する一緒に編集されてるやつを見付けて traceability にするやつ
名前によってmethod under test を決める手法
test の名前によって method under test を決める
brittle and applies to test cases that strictly follow naming convention
assertion の直前に呼ばれたコードを method under test とする手法
Last Call Before Assertion
looking at what happens right before the assert statement.
reasoning: the test case needs to call the unit under test to retrieve the actual status change.
code:java
var x = ...
assertEquals(x.sum(), 1) // この場合は x.sum がテスト対象?
We decided to use dynamic analysis for the LCBA resolution strategy, as to better deal with (i) polymorphism; (ii) conditional logic in test cases; and (iii) abstractions such as separate verification mechanisms.
a technique based on dynamic slicing to restore test case traceability links (inter-procedural ではない?) data-flow analysis と code slicing、目的が違うだけでやってること同じだと思うんだけど、(dynamic だからいいって話?)
さらに lexical analysis を組み合わせて精度をよくするぞー
問題はこれらの方法では stop-class-list (テスト対象ではないクラス一覧)を手動で作ってフィルタリングしている(そんな馬鹿な)
結構できが良さそう
Scotch と同じやつ
上の研究を元に code example を推薦するシステムを作った
テストから呼ばれているメソッドがそれぞれ inspect か、状態を変更するメソッドかどうかを inter-procedural data flow analysis で解析
状態を変更するメソッドのがテスト対象であることが多いだろう
こんな頑張らないとだめ?
割と最近の研究
構文木からidentifierを抜き出してdoc2vecにかけて、similarity が高い順に TCT を推薦したら良い精度が出た
TCT の visualize により、ユーザーは素早く production code から test code を探すことができるようになったよ
(新たな traceability recover を提案するものではない)
多分これが今のSoA
データも公開しててエラエラ
これまでの test-to-code traciability の研究はそれぞれの研究者が自分でアノテートしてて実験がやりにくかったよ
4つの Java project から method level の test-to-code traceability のデータセットを構築したよ
それぞれの repository のどの revision を使っているのかわからないので役に立たないんだけど????