An Automated Assistant for Reducing Duplication in Living Documentation
Total Page:16
File Type:pdf, Size:1020Kb
An Automated Assistant for Reducing Duplication in Living Documentation A dissertation submitted to the University of Manchester for the degree of Master of Science in the Faculty of Engineering and Physical Sciences. 2015 SIA WAI SUAN SCHOOL OF COMPUTER SCIENCE Table of Contents List of Figures ............................................................................................................. 6 List of Tables .............................................................................................................. 9 List of Abbreviations ............................................................................................... 10 Abstract ..................................................................................................................... 11 Declaration ................................................................................................................ 12 Intellectual Property Statement .............................................................................. 13 Acknowledgements ................................................................................................... 14 Chapter 1 : Introduction ......................................................................................... 15 1.1 Overview .......................................................................................................... 15 1.2 Aim ................................................................................................................... 17 1.2.1 Objectives .................................................................................................. 17 1.3 Dissertation Outline .......................................................................................... 17 Chapter 2 : Background .......................................................................................... 18 2.1 Overview .......................................................................................................... 18 2.2 Requirement Engineering (RE) ........................................................................ 18 2.3 Specification by Example (SbE) ...................................................................... 19 2.4 Acceptance Test-Driven Development (ATDD) .............................................. 24 2.4.1 ATDD Exemplar: FitNesse ........................................................................ 26 2.5 Behaviour-Driven Development (BDD) .......................................................... 28 2.5.1 BDD Exemplar: Cucumber ........................................................................ 30 2.6 Conclusion ........................................................................................................ 35 Chapter 3 : Duplication Detection and Analysis ................................................... 36 3.1 Overview .......................................................................................................... 36 3.2 Why BDD & Cucumber? ................................................................................. 36 3.3 What is Duplication in BDD? .......................................................................... 42 3.3.1 Good vs. Bad Duplication .......................................................................... 42 Page 2 of 110 3.4 Importance of Reducing Duplication in BDD .................................................. 45 3.5 Near-duplicates ................................................................................................. 46 3.6 Rules for Detecting Duplication ....................................................................... 47 3.6.1 Rule 1 ......................................................................................................... 48 3.6.2 Rule 2 ......................................................................................................... 49 3.6.3 Rule 3 ......................................................................................................... 49 3.6.4 Rule 4 ......................................................................................................... 50 3.6.5 Decision Tree ............................................................................................. 50 3.7 Duplicate Detection Algorithm ........................................................................ 51 3.7.1 Exact Duplicate Detection ......................................................................... 51 3.7.2 Near-Duplicate Detection .......................................................................... 52 3.7.3 Model of Duplication ................................................................................. 56 3.7.4 Process Flow .............................................................................................. 57 3.7.5 Limitations ................................................................................................. 61 3.8 Refactoring ....................................................................................................... 61 3.9 Methodology .................................................................................................... 64 3.9.1 Information Gathering ............................................................................... 64 3.9.2 Development .............................................................................................. 65 3.9.3 Deliverables ............................................................................................... 65 3.9.4 Evaluation .................................................................................................. 66 3.10 Conclusion ...................................................................................................... 66 Chapter 4 : Realizing the SEED tool ...................................................................... 67 4.1 Overview .......................................................................................................... 67 4.2 Software Design ............................................................................................... 67 4.2.1 Eclipse Plug-in Architecture ...................................................................... 67 4.2.2 SEED Architecture .................................................................................... 68 4.2.2 Domain Model Diagram ............................................................................ 71 Page 3 of 110 4.2.3 Class Diagram ............................................................................................ 72 4.3 Version Control System ................................................................................... 73 4.4 Functionality ..................................................................................................... 74 4.4.1 Duplicate Cucumber Feature Titles Detection........................................... 74 4.4.2 Duplicate Cucumber Scenario Titles Detection......................................... 76 4.4.3 Duplicate Cucumber Scenario Steps Detection ......................................... 77 4.4.4 Duplicate Cucumber Examples Table Rows Detection ............................. 79 4.4.5 Duplicate Cucumber Steps Detection ........................................................ 79 4.4.6 Duplicate Cucumber Pre-condition Steps Detection ................................. 81 4.4.7 Duplicate Cucumber Scenarios Detection ................................................. 83 4.5 Testing .............................................................................................................. 83 4.5.1 Unit Testing with Xtext ............................................................................. 84 4.6 Conclusion ........................................................................................................ 86 Chapter 5 : Evaluation ............................................................................................ 87 5.1 Overview .......................................................................................................... 87 5.2 Hypothesis & Prediction .................................................................................. 87 5.3 Approach .......................................................................................................... 88 5.4 Experiment 1 .................................................................................................... 90 5.4.1 Duplication................................................................................................. 91 5.4.2 Refactoring................................................................................................. 93 5.5 Experiment 2 .................................................................................................... 94 5.5.1 Duplication................................................................................................. 94 5.5.2 Refactoring................................................................................................. 96 5.6 Experiment 3 .................................................................................................... 97 5.6.1 Duplication................................................................................................. 98 5.6.2 Refactoring................................................................................................. 99 5.7 Results & Discussion ........................................................................................ 99 Page 4 of 110 5.8 Conclusion .....................................................................................................