skip to main content
10.1145/3213846.3213863acmconferencesArticle/Chapter ViewAbstractPublication PagesisstaConference Proceedingsconference-collections
research-article

Tests from traces: automated unit test extraction for R

Published: 12 July 2018 Publication History

Abstract

Unit tests are labor-intensive to write and maintain. This paper looks into how well unit tests for a target software package can be extracted from the execution traces of client code. Our objective is to reduce the effort involved in creating test suites while minimizing the number and size of individual tests, and maximizing coverage. To evaluate the viability of our approach, we select a challenging target for automated test extraction, namely R, a programming language that is popular for data science applications. The challenges presented by R are its extreme dynamism, coerciveness, and lack of types. This combination decrease the efficacy of traditional test extraction techniques. We present Genthat, a tool developed over the last couple of years to non-invasively record execution traces of R programs and extract unit tests from those traces. We have carried out an evaluation on 1,545 packages comprising 1.7M lines of R code. The tests extracted by Genthat improved code coverage from the original rather low value of 267,496 lines to 700,918 lines. The running time of the generated tests is 1.9 times faster than the code they came from

References

[1]
Chandrasekhar Boyapati, Sarfraz Khurshid, and Darko Marinov. 2002. Korat: Automated Testing Based on Java Predicates. In International Symposium on Software Testing and Analysis (ISSTA).
[2]
Koen Claessen and John Hughes. 2000. QuickCheck: a lightweight tool for random testing of Haskell programs. In International Conference on Functional Programming (ICFP).
[3]
Christoph Csallner and Yannis Smaragdakis. 2004. JCrasher: An Automatic Robustness Tester for Java. Softw. Pract. Exper. 34, 11 (2004).
[4]
1002/spe.602
[5]
Sebastian G. Elbaum, Hui Nee Chin, Matthew B. Dwyer, and Jonathan Dokulil. 2006. Carving differential unit test cases from system test cases. In International Symposium on Foundations of Software Engineering (FSE). 1181775.1181806
[6]
Michael Ernst, Sai Zhang, David Saff, and Yingyi Bu. 2011. Combined Static and Dynamic Automated Test Generation. In International Symposium on Software Testing and Analysis (ISSTA).
[7]
Hojun Jaygarl, Sunghun Kim, Tao Xie, and Carl Chang. 2010. OCAT: object capture-based automated testing. In nternational Symposium on Software Testing and Analysis (ISSTA).
[8]
Shrinivas Joshi and Alessandro Orso. 2007. SCARPE: A Technique and Tool for Selective Capture and Replay of Program Executions. In International Conference on Software Maintenance (ICSM).
[9]
Uwe Ligges. {n. d.}. 20 Years of CRAN (Video on Channel9. In Keynote at UseR!
[10]
Floréal Morandat, Brandon Hill, Leo Osvald, and Jan Vitek. 2012. Evaluating the Design of the R Language: Objects and Functions for Data Analysis. In European Conference on Object-Oriented Programming (ECOOP). 978-3-642-31057-7_6
[11]
R Core Team. 2017. R Internals 3.4.3.
[12]
R Core Team. 2017. R Language 3.4.3. 90019-7
[13]
R Core Team. 2017. Writing R Extensions 3.4.3. cropsci1998.0011183X003800020005x
[14]
Gregor Richards, Andreas Gal, Brendan Eich, and Jan Vitek. 2011. Automated Construction of JavaScript Benchmarks. In Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA). 1145/2048066.2048119
[15]
Thomas Rooney. 2015. Automated Test Generation through Runtime Execution Trace Analysis. Master’s thesis. Imparial College London.
[16]
David Saff, Shay Artzi, Jeff H. Perkins, and Michael D. Ernst. 2005. Automatic test factoring for Java. In International Conference on Automated Software Engineering (ASE).
[17]
Koushik Sen, Darko Marinov, and Gul Agha. 2005. CUTE: A Concolic Unit Testing Engine for C. In European Software Engineering Conference and International Symposium on Foundations of Software Engineering (ESEC/FSE).
[18]
O. Tange. 2011. GNU Parallel–The Command-Line Power Tool. ;login: The USENIX Magazine 42, 47 (2011).
[19]
O. Tange. 2018. GNU Parallel 2018.
[20]
Suresh Thummalapenta, Tao Xie, Nikolai Tillmann, Jonathan de Halleux, and Wolfram Schulte. 2009. MSeqGen: Object-oriented Unit-test Generation via Mining Source Code. In European Software Engineering Conference and Symposium on The Foundations of Software Engineering (ESEC/FSE). 1595696.1595725
[21]
Hadley Wickham. 2014. Advanced R (1 edition ed.). Chapman and Hall/CRC.
[22]
Shin Yoo and Mark Harman. 2012. Regression testing minimization, selection and prioritization: a survey. Software Testing, Verification and Reliability 22, 2 (2012), 67–120.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ISSTA 2018: Proceedings of the 27th ACM SIGSOFT International Symposium on Software Testing and Analysis
July 2018
379 pages
ISBN:9781450356992
DOI:10.1145/3213846
  • General Chair:
  • Frank Tip,
  • Program Chair:
  • Eric Bodden
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 12 July 2018

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Program tracing
  2. R
  3. Test extraction

Qualifiers

  • Research-article

Funding Sources

  • H2020 European Research Council

Conference

ISSTA '18
Sponsor:

Acceptance Rates

Overall Acceptance Rate 58 of 213 submissions, 27%

Upcoming Conference

ISSTA '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)13
  • Downloads (Last 6 weeks)2
Reflects downloads up to 28 Jan 2025

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media