software maintenance support by extracting links and models (revised)
TRANSCRIPT
Software Maintenance Support by Extracting Links and Models
(revised)
Hiro - Hironori Washizaki Waseda University / National Institute of Informatics
Twitter: @Hiro_Washi [email protected]
http://www.washi.cs.waseda.ac.jp/
PolyMORSE Seminar @ Ecole Polytechnique de Montreal, Nov 13, 2015
Software maintenance matters!
60–90% of total costs
2
B. Lientz and E. Swanson, Software Maintenance Management. Reading, Ma.: Addison-Wesley, 1980.
J. Conejero, E. Figueiredo, A. Garcia, J. Hernández and E. Jurado, "On the Relationship of Concern
Metrics and Requirements Maintainability,” Information and Software Technology, vol.54, no.2, 2012.
How can we support?
3
Requirements
Design
Program
source
code
How can we support?
4
Requirements
Design
Program
source
code
Tracing artifacts Tracing artifacts
Log-based interactive recovery [CAiSE’15]
Transitive recovery [ICSME’15 ERA]
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Kazuki Nishikawa, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Ohshima, Ryota Mibe, “Recovering Transitive Traceability Links
among Software Artifacts,” 31st IEEE International Conference on Software Maintenance and Evolution (ICSME 2015), ERA Track
Facts of traceability links • Relationships among software artifacts • Key to ensure consistency among artifacts [Antoniol‘00] • Rarely established explicitly [Lucia’12] • Most of existing recovery techniques employing
Information Retrieval (IR) approaches such as TF/IDF and Vector Space Model (VSM)
5
[Antoniol’00] G. Antoniol, B. Caprile, A. Potrich and P. Tonella, "Design-Code Traceability for Object-Oriented
Systems," Annals of Software Engineering, vol. 9, no. 1-4, pp. 35-58, 2000
[Lucia’12] A. De Lucia, et al., "Information Retrieval Methods for Automated Traceability Recovery," in Software and
Systems Traceability, 1st ed., J. Cleland-Huang, O. Gotel and A. Zisman, Ed. New York: Springer, p. 71-98, 2012.
Automated test
Automated.c MyMem.c
Initialization Requirement
基本テスト Basic.c
NG OK
Interactive recovery utilizing call relationships
Rank Requirement Code file Score Recommended Correct
1 Recover link
2 Recover link
3 Recover link
・・・ ・・・
6
Recover link
・・・
LinkPresenter.java ・・・
LinkRecover.java
ScoreCalc.java
・・・
Call
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Interactive recovery utilizing call relationships
Rank Requirement Code file Score Recommended Correct
1 Recover link LinkRecover.java 0.98 not yet
2 Recover link LinkPresenter.java 0.65 not yet
3 Recover link ScoreCalc.java 0.30 not yet
・・・ ・・・ ・・・ ・・・
7
Recover link
・・・
LinkPresenter.java ・・・
LinkRecover.java
ScoreCalc.java
・・・
☑
Call
☑
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Interactive recovery utilizing call relationships
Rank Requirement Code file Score Recommended Correct
1 Recover link LinkRecover.java 0.98 not yet
2 Recover link ScoreCalc.java 0.30 Recommended
3 Recover link LinkPresenter.java 0.65 not yet
・・・ ・・・ ・・・ ・・・
8
Recover link
・・・
LinkPresenter.java ・・・
LinkRecover.java
ScoreCalc.java
・・・
☑
Call
☑
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Automated test
Log-based recovery
9
Automated test
automate・・ ・・XML・・・ ・test・・・・・・
Requirement automate
XML
test
automate
XML
Keywords
High TF-IDF value Proper noun
Filtered by experts
automate
XML
Revision: 137 Author: anilsaharan Date: 2011/8/20 9:35:13 Message: Changes for fixing XML tag issue ---- Modified : /trunk/CUnit/Sources/Tool/Process.c
Process.c
・・・
Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Experiment: Japanese enterprise system
• 80,000 LOC, 192 requirements, 694 Java code files, 7090 revisions in Subversion
• 726 known links as correct answer
10 Ryosuke Tsuchiya, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Oshima, and Ryota Mibe,“Interactive Recovery of Requirements
Traceability Links Using User Feedback and Configuration Management Logs,” 27th International Conference on Advanced
Information Systems Engineering (CAiSE 2015)
Transitive recovery
11
Code Design Test ScoreC1 Da Tx 0.16C1 Da Ty 0.14C1 Db Tx 0.03
• Vector Space Model (VSM) for basic recovery
Source code Design Test case
Code Design SimilarityC1 Da 0.4C2 Db 0.3
Design Test SimilarityDa Tx 0.40Da Ty 0.35Db Tx 0.10
Kazuki Nishikawa, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Ohshima, Ryota Mibe, “Recovering Transitive Traceability Links
among Software Artifacts,” 31st IEEE International Conference on Software Maintenance and Evolution (ICSME 2015), ERA Track
Experiment: EasyClinic
• Target link: 47 Java code ⇔ 63 test docs
• Supportive artifacts: 20 design docs or 30 use cases
• Effectiveness varies with supportive artifacts
12 Kazuki Nishikawa, Hironori Washizaki, Yoshiaki Fukazawa, Keishi Ohshima, Ryota Mibe, “Recovering Transitive Traceability Links
among Software Artifacts,” 31st IEEE International Conference on Software Maintenance and Evolution (ICSME 2015), ERA Track
Related work and future
• Related work – Relevance feedback for traceability recovery [Lucia’06]
– Multi-faceted Interactive Exploration [Wanget’13]
– Recovery based on call or structural relationships in program [Kagdi’07][CSIE’09][Ghabiand’12]
• Possible future work – More sophisticated NLP and IR approaches (such as LSA,
LDA and ontology) for basic recovery
– Probability-based combination of similarity scores
13
[Lucia’06] Andrea De Lucia, Rocco Oliveto, and Paola Sgueglia, Incremental Approach and User Feedbacks: a Silver Bullet for
Traceability Recovery? , ICSM2006
[Wanget’13] J Wanget al., Improving Feature Location Practice with Multi-faceted Interactive Exploration, ICSE2013
[Kagdi’07] H. Kagdi, J. Maletic, and B. Sharif, “Mining Software Repositories for Traceability Links,” Proc. 15th IEEE Int’l Conf.
Program Comprehension, pp. 145-154, June, 2007.
[Kassab’09] M. Kassab, O. Ormandjieva, and M. Daneva, “A metamodel for tracing non-functional requirements,” WRI World
Congress on Computer Science and Information Engineering (CSIE’09), vol.7, pp.687-694, March, 2009.
[Ghabiand’12] A. Ghabiand A. Egyed., Code Patterns for Automatically Validating Requirements-to-Code Traces, ASE2012
How can we support?
14
Requirements
Design
Program
source
code
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
How can we support?
15
Requirements
Design
Program
source
code
Reversing model
Detecting problems Detecting problems
Ajax model extraction and verification
[ASE’13][ASE’14]
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
16
window.onload = setEventHandler;
function setEventHandler() {
$(“reg_type”).onchange = calcPrice;
・・・ $(“reg_addcart”).onclick = addCart;
};
function calcPrice() { ・・・ }; function addCart() {
if(isValidInput()) {
reqRunTrans();
} else {
alert(“Invalid user inputs”);
}
};
function reqRunTrans() {
new Ajax.Request(“runTrans.php”, {
method: “GET”, parameters: getParams(),
onSuccess: succeeded });
};
function succeeded() { disableAll();
jumpToConfirm();
}; Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
17
Extracted finite state machine
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
• #70 programming and usability patterns
• Potential faults: might not be revealed by testing
Ajax (Asynchronous JavaScript + XML) Design Patterns [Mahamoff’06]
18
[Mahamoff’06] M. Mahamoff, “Ajax Design Patterns”, O’Reilly Media Inc., 2006.
(i) Page load (ii) Option select
(iii) Add to cart
E.g. User Action “Prevent multiple
calls of specific user event handler”
Duplicate order
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
Duplicate order
19
Verifying invariants of specified pattern
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
20
window.onload = setEventHandler;
function setEventHandler() {
$(“reg_type”).onchange = calcPrice;
・・・ $(“reg_addcart”).onclick = addCart;
};
function calcPrice() { ・・・ }; function addCart() {
if(isValidInput()) {
$(“addCart”).disabled = true;
reqRunTrans();
} else {
alert(“Invalid user inputs”);
$(“addCart”).disabled = false;
}
};
function reqRunTrans() {
new Ajax.Request(“runTrans.php”, {
method: “GET”, parameters: getParams(),
onSuccess: succeeded }); };
function succeeded() { disableAll();
jumpToConfirm(); }; Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
• Developers are concerned with interactions[Duhl’03]
• Interaction = event + callback
• Rules are necessary for distinguishing interaction-related code fragments
Interaction-based state machine extraction
21
………………………………
………………………………
………………………………
………………………………
…………………………….…
………………………………
……………………………
function addCart() {… ………………………………
……………………..……
………………………………………
………………………………………
$(“addcart”).disabled=true; ………………………………………
………………………………………
……………………………………
…………
…………
…………
………………………………
………………………..……
………………………………
………………………………
………………………………
………………………………
………………………………
………………………………
………………………………
………………………………
…………………………
……………………………………………
……………………………………………
function setEventHandler() {
$(“addcart”).onclick=addCart; ……………………………………………
……………………………………………
……………………………………………
……………………………………………
……………………………………………
onclick
setEventHandler
ev
addCart
…disabled…
[c]
[!c]
[Duhl’03] J.Duhl, “White Paper: Rich Internet Applications”, IDC Technical Report’ 03.
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
Verification on Promela with LTL
22
Self interaction
User Server
active proctype App () {…}
App model
active proctype Interaction () {…}
Interaction model Faulty execution paths
Verification formulas (LTL)
Pattern Negative property
User Action <>(App_state == PreventFunc && App_event == UserEvent )
Yuta Maezawa, Hironori Washizaki, Yoshinori Tanabe and Shinichi Honiden, “Automated Verification of Pattern-based Interaction
Invariants in Ajax Applications,” 28th IEEE/ACM International Conference on Automated Software Engineering (ASE2013)
• Problem: Potential faults might not cause actual errors
• Assumption: Unexpected network latency make potential faults executable.
• Solution: Delay-based mutation and testing
Delay-based mutation
23
<button onclick=“handleClick()” /> ・・・ <script src=“handleClick.js” />
new DelayedRequest(3000).applyFunction( $.get , “myscript.php”, { name: “ABC” }, function(data) { alert(“Response is ” + data); } );
Synchronous delay Asynchronous delay
Original code
S1
S2 S3
Late response reveals!
Assumes immediate response
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
Case Study: industrial services
24
Subject JS
[LOC] #States #Trans.
#Invariants verified
#Potential faults
#Delay- Dependent
faults
2020 Marketing
2,468 15 547 4 1 1
ECD China 880 32 508 3 2 1
Easy Serviced Apartments
3,523 34 602 3 1 1
Undefined function call
Login failed with correct
username and password
Yuta Maezawa, Kazuki Nishiura, Hironori Washizaki, Shinichi Honiden, “Validating Ajax Applications Using a Delay-Based Mutation
Technique,” 29th IEEE/ACM International Conference on Automated Software Engineering (ASE 2014)
• Related work: state-based analysis and testing – Hard to find potential faults
– ReAjax[Marchetto’08]: DOM*/callback-exec as state/trans
– Crawljax[Mesbah’09]: Crawler for Ajax apps
– Artemis[Artzi’11]: Event sequences priorities
• Future work – Automated debugging: using solutions in patterns
– More mutation operators to reveal actual errors due to other potential faults except for ones related to delay
– Case studies on large-scale Ajax applications
Related work and future
25
[Marchetto’08] A. Marchetto, P. Tonella, and F. Ricca, “State-based testing of ajax web applications,” in Proc. Int’l
Conf. on Software Testing, Verification and Validation (ICST’08), Apr. 2008, pp. 121–130.
[Mesbah’09] A. Mesbah and A. van Deursen, “Invariant-based automatic testing of ajax user interfaces,” in Proc.
Int’l Conf. on Software Engineering (ICSE’09), May 2009, pp. 210–220.
[Artzi’11] S. Artzi, J. Dolby, S. H. Jensen, A. Moller, and F. Tip, “A framework for automated testing of javascript
web applications,” in Proc. Int’l Conf. on Software Engineering (ICSE’11), May 2011, pp. 571–580.
Summary
26
Reversing model
Tracing artifacts
Detecting problems Detecting problems
Tracing artifacts
Log-based interactive recovery [CAiSE’15]
Transitive recovery [ICSME’15 ERA]
Ajax model extraction and verification [ASE’13]
Ajax delay-based mutation [ASE’14]
27
Feb 24-26 (due Dec 4)
asianplop.org
Mar 15 (due Dec 11)
ppap.soccerlab.polymtl.ca
Mar 11 (due Jan 8)
samuraicoding.info
Mar 13-18 (due Sep 2016)
aster.or.jp/conference/icst2017/
10th IEEE International Conference on Software Testing, Verification and Validation
IPSJ International AI Programming Contest