Evaluation and Improvement of Automated Software Test Suites

Evaluation and Improvement of Automated Software Test Suites

Evaluation and Improvement of Automated Software Test Suites Von der Fakultät für Informatik, Elektrotechnik und Informationstechnik der Universität Stuttgart zur Erlangung der Würde eines Doktors der Naturwissenschaften (Dr. rer. nat.) genehmigte Abhandlung Vorgelegt von Rainer Niedermayr aus Bozen, Italien Hauptberichter: Prof. Dr. Stefan Wagner Mitberichter: Prof. Dr. Benoit Baudry Tag der mündlichen Prüfung: 7. Oktober 2019 Institut für Softwaretechnologie 2019 Acknowledgments This dissertation was written under the supervision of Prof. Dr. Stefan Wagner between 2015 and 2019. I am very grateful for his mentorship, academic guidance, and advice. In addition, I am thankful for my inclusion in the research group at the Institute of Software Technology at University of Stuttgart and want to thank all of the members for their support and the discussions at the seminars. My sincere thanks also go to Prof. Dr. Benoit Baudry for co-supervising this dissertation, inspiring discussions in Gothenburg and Stockholm, and his valuable feedback on my work. I am grateful for the support of Dr. Elmar Juergens, who had already been advisor of my Master’s thesis, for encouraging me to undertake a PhD and giving me the opportunity to do so at CQSE GmbH. I also want to thank him for our productive discussions. I wish to thank Oscar Luis Vera-Pérez for his interest in my work, his implementation of the Descartes plug-in, and our discussions. I am grateful to the numerous people who collaborated on papers, re- viewed papers, or gave feedback on this dissertation. They are, in alphabetical order: Florian Deißenböck, Nils Göde, Roman Haas, Elmar Juergens, Martin 3 Monperrus, Dennis Pagano, Jakob Rott, Tobias Röhm, Daniela Steidl, Alexan- der von Rhein, and Andreas Wilhelm. In addition, I am thankful to Florian Dreier and Jakob Rott for their work on the Test Impact Analysis and our discussions. I want to thank my family for their invaluable support, not only during my dissertation, but throughout my education. The funding from the German Federal Ministry of Education and Research (BMBF) is gratefully acknowledged. Stuttgart, 7th October 2019 Rainer Niedermayr 4 Zusammenfassung Automatisierte Softwaretests sind eine wichtige Qualitätssicherungsmaß- nahme in Softwareprojekten und helfen Fehler in einer Anwendung früh- zeitig aufzudecken. Zur Bewertung von Testsuiten wurden in der Vergan- genheit verschiedene Metriken und Verfahren vorgeschlagen. Dabei sind Code-Coverage-Metriken am weitesten verbreitet und werden vor allem in der kommerziellen Softwareentwicklung eingesetzt. Jedoch sind diese nur bedingt geeignet, die Effektivität von Testsuiten hinsichtlich ihrer Fehlerauf- deckungsrate zu bewerten. Ein anderes wirkungsvolles und aussagekräftiges Verfahren ist Mutation Testing, bei dem Fehler in den Anwendungscode einer Software eingefügt werden und geprüft wird, ob die vorhandenen Testfälle diese aufdecken können. In Bezug auf die Bestimmung der Testeffektivität ist Mutation Testing anderen Verfahren deutlich überlegen, jedoch ist es sehr rechenintensiv und sogenannte äquivalente Mutanten können die Ergebnisse verfälschen. Wegen dieser Probleme wird Mutation Testing in der Praxis derzeit kaum eingesetzt. Das Ziel dieser Dissertation ist es, aussagekräftigere Metriken und Verfah- ren zur Bewertung von Testsuiten zu entwickeln, welche mit vertretbarem Berechnungsaufwand anwendbar sind. Diese sollen Code-Coverage-Metriken in Bezug auf die Aussagekraft übertreffen und gleichzeitig weniger rechen- intensiv als derzeit verwendete Mutation-Testing-Verfahren sein. Dazu wurde ein leichtgewichtiges Verfahren zur Erkennung von schein- 5 getesteten Methoden konzipiert, umgesetzt und evaluiert. Scheingetestete Methoden sind von mindestens einem Testfall überdeckt, jedoch erkennt keiner der überdeckenden Testfälle, wenn die gesamte Logik aus der Me- thode entfernt wird. Außerdem wurde ein Machine-Learning-Modell zur Vorhersage von scheingetesteten Methoden entwickelt, welches ein neu eingeführtes Maß für die Aufrufdistanz zwischen Methoden und Testfällen sowie weitere kostengünstig berechenbare Metriken verwendet. Im Rahmen der Arbeit wurde ein weiteres Machine-Learning-Modell zur Identifizierung von Methoden mit einem niedrigem Fehlerrisiko vorgeschlagen. Solche Me- thoden können bei Qualitätssicherungsmaßnahmen nachrangig behandelt oder ausgeschlossen werden, sodass beispielsweise der Aufwand für die Erkennung scheingetesteter Methoden weiter reduziert wird. Die Ergebnisse zeigen, dass scheingetestete Methoden in allen untersuch- ten Studienobjekten auftreten und relevante Testunzulänglichkeiten darstel- len. Machine-Learning-Modelle können scheingetestete Methoden effizient vorhersagen, sodass diese Modelle als eine kostengünstige Annäherung vor einer Mutationsanalyse eingesetzt oder in Situationen verwendet wer- den können, in denen Mutationsanalysen nicht anwendbar sind. Mit einem weiteren Machine-Learning-Modell können basierend auf Code-Metriken Methoden identifiziert werden, die ein niedriges Fehlerrisiko aufweisen. Dies trifft auf etwa ein Drittel der Methoden zu, die folglich im Test miteiner niedrigeren Priorität behandelt werden können. Die entworfenen Verfahren ermöglichen sowohl eine verhältnismäßig leichtgewichtige, anwendbare Berechnung von scheingetesteten Methoden als auch eine Vorhersage derselben basierend auf Methoden- und Testfall- metriken. Durch scheingetestete Methoden aufgedeckte Probleme in Test- suiten sind für Entwickler einfach verständlich und adressierbar, sodass Entwickler die Effektivität ihrer Testsuite verbessern können. Außerdem hilft die Identifikation von Methoden mit einem niedrigen Fehlerrisiko, Testauf- wände auf relevante Methoden zu fokussieren. Effektivere Testsuiten können mehr Fehler bereits während des Softwareentwicklungsprozesses aufdecken und helfen damit, die Qualität eines Softwareprodukts zu verbessern sowie Fehlerfolgekosten zu reduzieren. 6 Abstract Automated software tests are an important means of quality assurance in software projects and for helping to detect faults in software products early. While various measures and techniques have been proposed to evaluate test suites, code coverage metrics are the most common and are widely used in industry. However, it is questionable whether code coverage metrics are suitable to determine the fault detection capabilities of a test suite. Another powerful and valid technique for assessing test suites is mutation testing, which introduces faults into an application’s code and checks whether the existing test cases can detect them. When determining fault detection capabilities, mutation testing is clearly superior to other measures, but it is computationally very complex and suffers from the problem of equivalent mutants, which distort the results. Due to these problems, mutation testing has rarely been adopted as a test adequacy criterion in practice. The aim of this dissertation was to develop measures and techniques to better determine the effectiveness of a test suite with reasonable computa- tional efforts. We wanted to come up with an approach that outperforms code coverage metrics in terms of validity and is, at the same time, less resource-intensive than currently used mutation testing approaches. To do this, we proposed, implemented and evaluated a light-weight mu- tation approach to identify pseudo-tested methods; that is, methods that 7 are covered by at least one test case, but none of the test cases can detect the removal of the whole logic from the method. We further developed a machine-learning model to predict pseudo-tested methods based on a newly introduced measure for characterizing the proximity between meth- ods and test cases and further easily computable measures. We also built machine-learning models to identify low-fault-risk methods, which can be excluded from quality-assurance activities to focus on the relevant methods and further speed up pseudo-testedness analyses. The results show that pseudo-tested methods exist in all analyzed study objects and constitute relevant test inadequacies. Prediction models can efficiently identify pseudo-tested methods, which means that such models can be applied as a preceding, less costly step to mutation testing or be used in scenarios where mutation testing is not applicable. Depending on what level of risk is acceptable, approximately one-third of the methods can be classified as having a low fault risk, and these methods can be predicted with a machine-learning model based on code metrics. The devised approaches make it possible to identify pseudo-tested methods by using an applicable, light-weight computation or a prediction based on method and test case metrics. Flaws in test suites uncovered by pseudo-tested methods are easy for developers to interpret and take action on, enabling the developers to improve the effectiveness of their test suite. The identification of methods with a low fault risk helps allocate test suite improvement efforts to the relevant methods. More effective test suites can reveal more faults during the software development phase, which can help improve the overall quality of a software product and reduce failure follow-up costs. 8 Contents 1 Introduction 13 1.1 Motivation ................................. 14 1.2 Problem Statement ........................... 15 1.3 Research Goal............................... 16 1.4 Contributions to Knowledge ...................... 17 1.5 Previously Published Material ..................... 19 1.6 Structure of Dissertation .......................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    217 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us